// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Represents a request to perform a single point-in-time capture of
/// some portion of the state of a GKE cluster, the record of the backup
/// operation itself, and an anchor for the underlying artifacts that
/// comprise the Backup (the config backup and VolumeBackups).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Backup {
    /// Output only. The fully qualified name of the Backup.
    /// `projects/*/locations/*/backupPlans/*/backups/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
    pub uid: std::string::String,

    /// Output only. The timestamp when this Backup resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this Backup resource was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. This flag indicates whether this Backup resource was created
    /// manually by a user or via a schedule in the BackupPlan. A value of True
    /// means that the Backup was created manually.
    pub manual: bool,

    /// Optional. A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Minimum age for this Backup (in days). If this field is set to a
    /// non-zero value, the Backup will be "locked" against deletion (either manual
    /// or automatic deletion) for the number of days provided (measured from the
    /// creation time of the Backup).  MUST be an integer value between 0-90
    /// (inclusive).
    ///
    /// Defaults to parent BackupPlan's
    /// [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]
    /// setting and may only be increased
    /// (either at creation time or in a subsequent update).
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]: crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days
    pub delete_lock_days: i32,

    /// Output only. The time at which an existing delete lock will expire for this
    /// backup (calculated from create_time +
    /// [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days]).
    ///
    /// [google.cloud.gkebackup.v1.Backup.delete_lock_days]: crate::model::Backup::delete_lock_days
    pub delete_lock_expire_time: std::option::Option<wkt::Timestamp>,

    /// Optional. The age (in days) after which this Backup will be automatically
    /// deleted. Must be an integer value >= 0:
    ///
    /// - If 0, no automatic deletion will occur for this Backup.
    /// - If not 0, this must be >=
    ///   [delete_lock_days][google.cloud.gkebackup.v1.Backup.delete_lock_days] and
    ///   <= 365.
    ///
    /// Once a Backup is created, this value may only be increased.
    ///
    /// Defaults to the parent BackupPlan's
    /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.Backup.delete_lock_days]: crate::model::Backup::delete_lock_days
    /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
    pub retain_days: i32,

    /// Output only. The time at which this Backup will be automatically deleted
    /// (calculated from create_time +
    /// [retain_days][google.cloud.gkebackup.v1.Backup.retain_days]).
    ///
    /// [google.cloud.gkebackup.v1.Backup.retain_days]: crate::model::Backup::retain_days
    pub retain_expire_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The customer managed encryption key that was used to encrypt
    /// the Backup's artifacts.  Inherited from the parent BackupPlan's
    /// [encryption_key][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.encryption_key]: crate::model::backup_plan::BackupConfig::encryption_key
    pub encryption_key: std::option::Option<crate::model::EncryptionKey>,

    /// Output only. Whether or not the Backup contains volume data.  Controlled by
    /// the parent BackupPlan's
    /// [include_volume_data][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_volume_data]: crate::model::backup_plan::BackupConfig::include_volume_data
    pub contains_volume_data: bool,

    /// Output only. Whether or not the Backup contains Kubernetes Secrets.
    /// Controlled by the parent BackupPlan's
    /// [include_secrets][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.include_secrets]: crate::model::backup_plan::BackupConfig::include_secrets
    pub contains_secrets: bool,

    /// Output only. Information about the GKE cluster from which this Backup was
    /// created.
    pub cluster_metadata: std::option::Option<crate::model::backup::ClusterMetadata>,

    /// Output only. Current state of the Backup
    pub state: crate::model::backup::State,

    /// Output only. Human-readable description of why the backup is in the current
    /// `state`. This field is only meant for human readability and should not be
    /// used programmatically as this field is not guaranteed to be consistent.
    pub state_reason: std::string::String,

    /// Output only. Completion time of the Backup
    pub complete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The total number of Kubernetes resources included in the
    /// Backup.
    pub resource_count: i32,

    /// Output only. The total number of volume backups contained in the Backup.
    pub volume_count: i32,

    /// Output only. The total size of the Backup in bytes = config backup size +
    /// sum(volume backup sizes)
    pub size_bytes: i64,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a backup from overwriting each other.
    /// It is strongly suggested that systems make use of the `etag` in the
    /// read-modify-write cycle to perform backup updates in order to avoid
    /// race conditions: An `etag` is returned in the response to `GetBackup`,
    /// and systems are expected to put that etag in the request to
    /// `UpdateBackup` or `DeleteBackup` to ensure that their change will be
    /// applied to the same version of the resource.
    pub etag: std::string::String,

    /// Optional. User specified descriptive string for this Backup.
    pub description: std::string::String,

    /// Output only. The total number of Kubernetes Pods contained in the Backup.
    pub pod_count: i32,

    /// Output only. The size of the config backup in bytes.
    pub config_backup_size_bytes: i64,

    /// Output only. If false, Backup will fail when Backup for GKE detects
    /// Kubernetes configuration that is non-standard or
    /// requires additional setup to restore.
    ///
    /// Inherited from the parent BackupPlan's
    /// [permissive_mode][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.permissive_mode]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.permissive_mode]: crate::model::backup_plan::BackupConfig::permissive_mode
    pub permissive_mode: bool,

    /// Output only. [Output Only] Reserved for future use.
    pub satisfies_pzs: bool,

    /// Output only. [Output Only] Reserved for future use.
    pub satisfies_pzi: bool,

    /// Defines the "scope" of the Backup - which namespaced resources in the
    /// cluster were included in the Backup.  Inherited from the parent
    /// BackupPlan's
    /// [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]: crate::model::backup_plan::BackupConfig::backup_scope
    pub backup_scope: std::option::Option<crate::model::backup::BackupScope>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Backup {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Backup::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::Backup::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Backup::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Backup::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Backup::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [manual][crate::model::Backup::manual].
    pub fn set_manual<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.manual = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::Backup::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [delete_lock_days][crate::model::Backup::delete_lock_days].
    pub fn set_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.delete_lock_days = v.into();
        self
    }

    /// Sets the value of [delete_lock_expire_time][crate::model::Backup::delete_lock_expire_time].
    pub fn set_delete_lock_expire_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_lock_expire_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [delete_lock_expire_time][crate::model::Backup::delete_lock_expire_time].
    pub fn set_or_clear_delete_lock_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.delete_lock_expire_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [retain_days][crate::model::Backup::retain_days].
    pub fn set_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.retain_days = v.into();
        self
    }

    /// Sets the value of [retain_expire_time][crate::model::Backup::retain_expire_time].
    pub fn set_retain_expire_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.retain_expire_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [retain_expire_time][crate::model::Backup::retain_expire_time].
    pub fn set_or_clear_retain_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.retain_expire_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [encryption_key][crate::model::Backup::encryption_key].
    pub fn set_encryption_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EncryptionKey>,
    {
        self.encryption_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [encryption_key][crate::model::Backup::encryption_key].
    pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EncryptionKey>,
    {
        self.encryption_key = v.map(|x| x.into());
        self
    }

    /// Sets the value of [contains_volume_data][crate::model::Backup::contains_volume_data].
    pub fn set_contains_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.contains_volume_data = v.into();
        self
    }

    /// Sets the value of [contains_secrets][crate::model::Backup::contains_secrets].
    pub fn set_contains_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.contains_secrets = v.into();
        self
    }

    /// Sets the value of [cluster_metadata][crate::model::Backup::cluster_metadata].
    pub fn set_cluster_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::backup::ClusterMetadata>,
    {
        self.cluster_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [cluster_metadata][crate::model::Backup::cluster_metadata].
    pub fn set_or_clear_cluster_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::backup::ClusterMetadata>,
    {
        self.cluster_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::Backup::state].
    pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_reason][crate::model::Backup::state_reason].
    pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_reason = v.into();
        self
    }

    /// Sets the value of [complete_time][crate::model::Backup::complete_time].
    pub fn set_complete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [complete_time][crate::model::Backup::complete_time].
    pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resource_count][crate::model::Backup::resource_count].
    pub fn set_resource_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.resource_count = v.into();
        self
    }

    /// Sets the value of [volume_count][crate::model::Backup::volume_count].
    pub fn set_volume_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.volume_count = v.into();
        self
    }

    /// Sets the value of [size_bytes][crate::model::Backup::size_bytes].
    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.size_bytes = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::Backup::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Backup::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [pod_count][crate::model::Backup::pod_count].
    pub fn set_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.pod_count = v.into();
        self
    }

    /// Sets the value of [config_backup_size_bytes][crate::model::Backup::config_backup_size_bytes].
    pub fn set_config_backup_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.config_backup_size_bytes = v.into();
        self
    }

    /// Sets the value of [permissive_mode][crate::model::Backup::permissive_mode].
    pub fn set_permissive_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.permissive_mode = v.into();
        self
    }

    /// Sets the value of [satisfies_pzs][crate::model::Backup::satisfies_pzs].
    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzs = v.into();
        self
    }

    /// Sets the value of [satisfies_pzi][crate::model::Backup::satisfies_pzi].
    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzi = v.into();
        self
    }

    /// Sets the value of [backup_scope][crate::model::Backup::backup_scope].
    ///
    /// Note that all the setters affecting `backup_scope` are mutually
    /// exclusive.
    pub fn set_backup_scope<
        T: std::convert::Into<std::option::Option<crate::model::backup::BackupScope>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.backup_scope = v.into();
        self
    }

    /// The value of [backup_scope][crate::model::Backup::backup_scope]
    /// if it holds a `AllNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn all_namespaces(&self) -> std::option::Option<&bool> {
        #[allow(unreachable_patterns)]
        self.backup_scope.as_ref().and_then(|v| match v {
            crate::model::backup::BackupScope::AllNamespaces(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
    /// to hold a `AllNamespaces`.
    ///
    /// Note that all the setters affecting `backup_scope` are
    /// mutually exclusive.
    pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.backup_scope =
            std::option::Option::Some(crate::model::backup::BackupScope::AllNamespaces(v.into()));
        self
    }

    /// The value of [backup_scope][crate::model::Backup::backup_scope]
    /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn selected_namespaces(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
        #[allow(unreachable_patterns)]
        self.backup_scope.as_ref().and_then(|v| match v {
            crate::model::backup::BackupScope::SelectedNamespaces(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
    /// to hold a `SelectedNamespaces`.
    ///
    /// Note that all the setters affecting `backup_scope` are
    /// mutually exclusive.
    pub fn set_selected_namespaces<
        T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.backup_scope = std::option::Option::Some(
            crate::model::backup::BackupScope::SelectedNamespaces(v.into()),
        );
        self
    }

    /// The value of [backup_scope][crate::model::Backup::backup_scope]
    /// if it holds a `SelectedApplications`, `None` if the field is not set or
    /// holds a different branch.
    pub fn selected_applications(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
        #[allow(unreachable_patterns)]
        self.backup_scope.as_ref().and_then(|v| match v {
            crate::model::backup::BackupScope::SelectedApplications(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [backup_scope][crate::model::Backup::backup_scope]
    /// to hold a `SelectedApplications`.
    ///
    /// Note that all the setters affecting `backup_scope` are
    /// mutually exclusive.
    pub fn set_selected_applications<
        T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.backup_scope = std::option::Option::Some(
            crate::model::backup::BackupScope::SelectedApplications(v.into()),
        );
        self
    }
}

impl wkt::message::Message for Backup {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.Backup"
    }
}

/// Defines additional types related to [Backup].
pub mod backup {
    #[allow(unused_imports)]
    use super::*;

    /// Information about the GKE cluster from which this Backup was created.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ClusterMetadata {
        /// Output only. The source cluster from which this Backup was created.
        /// Valid formats:
        ///
        /// - `projects/*/locations/*/clusters/*`
        /// - `projects/*/zones/*/clusters/*`
        ///
        /// This is inherited from the parent BackupPlan's
        /// [cluster][google.cloud.gkebackup.v1.BackupPlan.cluster] field.
        ///
        /// [google.cloud.gkebackup.v1.BackupPlan.cluster]: crate::model::BackupPlan::cluster
        pub cluster: std::string::String,

        /// Output only. The Kubernetes server version of the source cluster.
        pub k8s_version: std::string::String,

        /// Output only. A list of the Backup for GKE CRD versions found in the
        /// cluster.
        pub backup_crd_versions:
            std::collections::HashMap<std::string::String, std::string::String>,

        /// Platform-specific version
        pub platform_version:
            std::option::Option<crate::model::backup::cluster_metadata::PlatformVersion>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ClusterMetadata {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cluster][crate::model::backup::ClusterMetadata::cluster].
        pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.cluster = v.into();
            self
        }

        /// Sets the value of [k8s_version][crate::model::backup::ClusterMetadata::k8s_version].
        pub fn set_k8s_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.k8s_version = v.into();
            self
        }

        /// Sets the value of [backup_crd_versions][crate::model::backup::ClusterMetadata::backup_crd_versions].
        pub fn set_backup_crd_versions<T, K, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = (K, V)>,
            K: std::convert::Into<std::string::String>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.backup_crd_versions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
            self
        }

        /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version].
        ///
        /// Note that all the setters affecting `platform_version` are mutually
        /// exclusive.
        pub fn set_platform_version<
            T: std::convert::Into<
                    std::option::Option<crate::model::backup::cluster_metadata::PlatformVersion>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.platform_version = v.into();
            self
        }

        /// The value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
        /// if it holds a `GkeVersion`, `None` if the field is not set or
        /// holds a different branch.
        pub fn gke_version(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.platform_version.as_ref().and_then(|v| match v {
                crate::model::backup::cluster_metadata::PlatformVersion::GkeVersion(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
        /// to hold a `GkeVersion`.
        ///
        /// Note that all the setters affecting `platform_version` are
        /// mutually exclusive.
        pub fn set_gke_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.platform_version = std::option::Option::Some(
                crate::model::backup::cluster_metadata::PlatformVersion::GkeVersion(v.into()),
            );
            self
        }

        /// The value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
        /// if it holds a `AnthosVersion`, `None` if the field is not set or
        /// holds a different branch.
        pub fn anthos_version(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.platform_version.as_ref().and_then(|v| match v {
                crate::model::backup::cluster_metadata::PlatformVersion::AnthosVersion(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [platform_version][crate::model::backup::ClusterMetadata::platform_version]
        /// to hold a `AnthosVersion`.
        ///
        /// Note that all the setters affecting `platform_version` are
        /// mutually exclusive.
        pub fn set_anthos_version<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.platform_version = std::option::Option::Some(
                crate::model::backup::cluster_metadata::PlatformVersion::AnthosVersion(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for ClusterMetadata {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.Backup.ClusterMetadata"
        }
    }

    /// Defines additional types related to [ClusterMetadata].
    pub mod cluster_metadata {
        #[allow(unused_imports)]
        use super::*;

        /// Platform-specific version
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum PlatformVersion {
            /// Output only. GKE version
            GkeVersion(std::string::String),
            /// Output only. Anthos version
            AnthosVersion(std::string::String),
        }
    }

    /// State
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The Backup resource is in the process of being created.
        Unspecified,
        /// The Backup resource has been created and the associated BackupJob
        /// Kubernetes resource has been injected into the source cluster.
        Creating,
        /// The gkebackup agent in the cluster has begun executing the backup
        /// operation.
        InProgress,
        /// The backup operation has completed successfully.
        Succeeded,
        /// The backup operation has failed.
        Failed,
        /// This Backup resource (and its associated artifacts) is in the process
        /// of being deleted.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::InProgress => std::option::Option::Some(2),
                Self::Succeeded => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Deleting => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::InProgress,
                3 => Self::Succeeded,
                4 => Self::Failed,
                5 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "IN_PROGRESS" => Self::InProgress,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::InProgress => serializer.serialize_i32(2),
                Self::Succeeded => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Deleting => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.Backup.State",
            ))
        }
    }

    /// Defines the "scope" of the Backup - which namespaced resources in the
    /// cluster were included in the Backup.  Inherited from the parent
    /// BackupPlan's
    /// [backup_scope][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]
    /// value.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.BackupConfig.backup_scope]: crate::model::backup_plan::BackupConfig::backup_scope
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum BackupScope {
        /// Output only. If True, all namespaces were included in the Backup.
        AllNamespaces(bool),
        /// Output only. If set, the list of namespaces that were included in the
        /// Backup.
        SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
        /// Output only. If set, the list of ProtectedApplications whose resources
        /// were included in the Backup.
        SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
    }
}

/// A BackupChannel imposes constraints on where clusters can be backed up.
/// The BackupChannel should be in the same project and region
/// as the cluster being backed up.
/// The backup can be created only in destination_project.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BackupChannel {
    /// Identifier. The fully qualified name of the BackupChannel.
    /// `projects/*/locations/*/backupChannels/*`
    pub name: std::string::String,

    /// Required. Immutable. The project where Backups are allowed to be stored.
    /// The format is `projects/{projectId}` or `projects/{projectNumber}`.
    pub destination_project: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this BackupChannel resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this BackupChannel resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. User specified descriptive string for this BackupChannel.
    pub description: std::string::String,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a BackupChannel from overwriting each
    /// other. It is strongly suggested that systems make use of the 'etag' in the
    /// read-modify-write cycle to perform BackupChannel updates in order to
    /// avoid race conditions: An `etag` is returned in the response to
    /// `GetBackupChannel`, and systems are expected to put that etag in the
    /// request to `UpdateBackupChannel` or `DeleteBackupChannel` to
    /// ensure that their change will be applied to the same version of the
    /// resource.
    pub etag: std::string::String,

    /// Output only. The project_id where Backups are allowed to be stored.
    /// Example Project ID: "my-project-id".
    /// This will be an OUTPUT_ONLY field to return the project_id of the
    /// destination project.
    pub destination_project_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BackupChannel {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::BackupChannel::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination_project][crate::model::BackupChannel::destination_project].
    pub fn set_destination_project<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_project = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::BackupChannel::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::BackupChannel::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::BackupChannel::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::BackupChannel::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::BackupChannel::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::BackupChannel::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::BackupChannel::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::BackupChannel::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [destination_project_id][crate::model::BackupChannel::destination_project_id].
    pub fn set_destination_project_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_project_id = v.into();
        self
    }
}

impl wkt::message::Message for BackupChannel {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.BackupChannel"
    }
}

/// Defines the configuration and scheduling for a "line" of Backups.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BackupPlan {
    /// Output only. The full name of the BackupPlan resource.
    /// Format: `projects/*/locations/*/backupPlans/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this BackupPlan resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this BackupPlan resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User specified descriptive string for this BackupPlan.
    pub description: std::string::String,

    /// Required. Immutable. The source cluster from which Backups will be created
    /// via this BackupPlan. Valid formats:
    ///
    /// - `projects/*/locations/*/clusters/*`
    /// - `projects/*/zones/*/clusters/*`
    pub cluster: std::string::String,

    /// Optional. RetentionPolicy governs lifecycle of Backups created under this
    /// plan.
    pub retention_policy: std::option::Option<crate::model::backup_plan::RetentionPolicy>,

    /// Optional. A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Defines a schedule for automatic Backup creation via this
    /// BackupPlan.
    pub backup_schedule: std::option::Option<crate::model::backup_plan::Schedule>,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a backup plan from overwriting each
    /// other. It is strongly suggested that systems make use of the 'etag' in the
    /// read-modify-write cycle to perform BackupPlan updates in order to avoid
    /// race conditions: An `etag` is returned in the response to `GetBackupPlan`,
    /// and systems are expected to put that etag in the request to
    /// `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change
    /// will be applied to the same version of the resource.
    pub etag: std::string::String,

    /// Optional. This flag indicates whether this BackupPlan has been deactivated.
    /// Setting this field to True locks the BackupPlan such that no further
    /// updates will be allowed (except deletes), including the deactivated field
    /// itself. It also prevents any new Backups from being created via this
    /// BackupPlan (including scheduled Backups).
    ///
    /// Default: False
    pub deactivated: bool,

    /// Optional. Defines the configuration of Backups created via this BackupPlan.
    pub backup_config: std::option::Option<crate::model::backup_plan::BackupConfig>,

    /// Output only. The number of Kubernetes Pods backed up in the
    /// last successful Backup created via this BackupPlan.
    pub protected_pod_count: i32,

    /// Output only. State of the BackupPlan. This State field reflects the
    /// various stages a BackupPlan can be in
    /// during the Create operation. It will be set to "DEACTIVATED"
    /// if the BackupPlan is deactivated on an Update
    pub state: crate::model::backup_plan::State,

    /// Output only. Human-readable description of why BackupPlan is in the current
    /// `state`. This field is only meant for human readability and should not be
    /// used programmatically as this field is not guaranteed to be consistent.
    pub state_reason: std::string::String,

    /// Output only. A number that represents the current risk level of this
    /// BackupPlan from RPO perspective with 1 being no risk and 5 being highest
    /// risk.
    pub rpo_risk_level: i32,

    /// Output only. Human-readable description of why the BackupPlan is in the
    /// current rpo_risk_level and action items if any.
    pub rpo_risk_reason: std::string::String,

    /// Output only. The fully qualified name of the BackupChannel to be used to
    /// create a backup. This field is set only if the cluster being backed up is
    /// in a different project.
    /// `projects/*/locations/*/backupChannels/*`
    pub backup_channel: std::string::String,

    /// Output only. Completion time of the last successful Backup. This is sourced
    /// from a successful Backup's complete_time field. This field is added to
    /// maintain consistency with BackupPlanBinding to display last successful
    /// backup time.
    pub last_successful_backup_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BackupPlan {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::BackupPlan::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::BackupPlan::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::BackupPlan::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::BackupPlan::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::BackupPlan::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::BackupPlan::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::BackupPlan::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [cluster][crate::model::BackupPlan::cluster].
    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.cluster = v.into();
        self
    }

    /// Sets the value of [retention_policy][crate::model::BackupPlan::retention_policy].
    pub fn set_retention_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::RetentionPolicy>,
    {
        self.retention_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [retention_policy][crate::model::BackupPlan::retention_policy].
    pub fn set_or_clear_retention_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::RetentionPolicy>,
    {
        self.retention_policy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::BackupPlan::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [backup_schedule][crate::model::BackupPlan::backup_schedule].
    pub fn set_backup_schedule<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::Schedule>,
    {
        self.backup_schedule = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_schedule][crate::model::BackupPlan::backup_schedule].
    pub fn set_or_clear_backup_schedule<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::Schedule>,
    {
        self.backup_schedule = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::BackupPlan::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [deactivated][crate::model::BackupPlan::deactivated].
    pub fn set_deactivated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.deactivated = v.into();
        self
    }

    /// Sets the value of [backup_config][crate::model::BackupPlan::backup_config].
    pub fn set_backup_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::BackupConfig>,
    {
        self.backup_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_config][crate::model::BackupPlan::backup_config].
    pub fn set_or_clear_backup_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan::BackupConfig>,
    {
        self.backup_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [protected_pod_count][crate::model::BackupPlan::protected_pod_count].
    pub fn set_protected_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.protected_pod_count = v.into();
        self
    }

    /// Sets the value of [state][crate::model::BackupPlan::state].
    pub fn set_state<T: std::convert::Into<crate::model::backup_plan::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_reason][crate::model::BackupPlan::state_reason].
    pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_reason = v.into();
        self
    }

    /// Sets the value of [rpo_risk_level][crate::model::BackupPlan::rpo_risk_level].
    pub fn set_rpo_risk_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.rpo_risk_level = v.into();
        self
    }

    /// Sets the value of [rpo_risk_reason][crate::model::BackupPlan::rpo_risk_reason].
    pub fn set_rpo_risk_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.rpo_risk_reason = v.into();
        self
    }

    /// Sets the value of [backup_channel][crate::model::BackupPlan::backup_channel].
    pub fn set_backup_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_channel = v.into();
        self
    }

    /// Sets the value of [last_successful_backup_time][crate::model::BackupPlan::last_successful_backup_time].
    pub fn set_last_successful_backup_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_successful_backup_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [last_successful_backup_time][crate::model::BackupPlan::last_successful_backup_time].
    pub fn set_or_clear_last_successful_backup_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.last_successful_backup_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for BackupPlan {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan"
    }
}

/// Defines additional types related to [BackupPlan].
pub mod backup_plan {
    #[allow(unused_imports)]
    use super::*;

    /// RetentionPolicy defines a Backup retention policy for a BackupPlan.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RetentionPolicy {
        /// Optional. Minimum age for Backups created via this BackupPlan (in days).
        /// This field MUST be an integer value between 0-90 (inclusive).
        /// A Backup created under this BackupPlan will NOT be deletable until it
        /// reaches Backup's (create_time + backup_delete_lock_days).
        /// Updating this field of a BackupPlan does NOT affect existing Backups
        /// under it. Backups created AFTER a successful update will inherit
        /// the new value.
        ///
        /// Default: 0 (no delete blocking)
        pub backup_delete_lock_days: i32,

        /// Optional. The default maximum age of a Backup created via this
        /// BackupPlan. This field MUST be an integer value >= 0 and <= 365. If
        /// specified, a Backup created under this BackupPlan will be automatically
        /// deleted after its age reaches (create_time + backup_retain_days). If not
        /// specified, Backups created under this BackupPlan will NOT be subject to
        /// automatic deletion. Updating this field does NOT affect existing Backups
        /// under it. Backups created AFTER a successful update will automatically
        /// pick up the new value. NOTE: backup_retain_days must be >=
        /// [backup_delete_lock_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days].
        /// If
        /// [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]
        /// is defined, then this must be
        /// <= 360 * the creation interval. If
        /// [rpo_config][google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config] is
        /// defined, then this must be
        /// <= 360 * [target_rpo_minutes][Schedule.rpo_config.target_rpo_minutes] /
        /// (1440minutes/day).
        ///
        /// Default: 0 (no automatic deletion)
        ///
        /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days]: crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days
        /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]: crate::model::backup_plan::Schedule::cron_schedule
        /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]: crate::model::backup_plan::Schedule::rpo_config
        pub backup_retain_days: i32,

        /// Optional. This flag denotes whether the retention policy of this
        /// BackupPlan is locked.  If set to True, no further update is allowed on
        /// this policy, including the `locked` field itself.
        ///
        /// Default: False
        pub locked: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RetentionPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [backup_delete_lock_days][crate::model::backup_plan::RetentionPolicy::backup_delete_lock_days].
        pub fn set_backup_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.backup_delete_lock_days = v.into();
            self
        }

        /// Sets the value of [backup_retain_days][crate::model::backup_plan::RetentionPolicy::backup_retain_days].
        pub fn set_backup_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.backup_retain_days = v.into();
            self
        }

        /// Sets the value of [locked][crate::model::backup_plan::RetentionPolicy::locked].
        pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.locked = v.into();
            self
        }
    }

    impl wkt::message::Message for RetentionPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy"
        }
    }

    /// Defines scheduling parameters for automatically creating Backups
    /// via this BackupPlan.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Schedule {
        /// Optional. A standard [cron](https://wikipedia.com/wiki/cron) string that
        /// defines a repeating schedule for creating Backups via this BackupPlan.
        /// This is mutually exclusive with the
        /// [rpo_config][google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]
        /// field since at most one schedule can be defined for a BackupPlan. If this
        /// is defined, then
        /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
        /// must also be defined.
        ///
        /// Default (empty): no automatic backup creation will occur.
        ///
        /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
        /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config]: crate::model::backup_plan::Schedule::rpo_config
        pub cron_schedule: std::string::String,

        /// Optional. This flag denotes whether automatic Backup creation is paused
        /// for this BackupPlan.
        ///
        /// Default: False
        pub paused: bool,

        /// Optional. Defines the RPO schedule configuration for this BackupPlan.
        /// This is mutually exclusive with the
        /// [cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]
        /// field since at most one schedule can be defined for a BackupPLan. If this
        /// is defined, then
        /// [backup_retain_days][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]
        /// must also be defined.
        ///
        /// Default (empty): no automatic backup creation will occur.
        ///
        /// [google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_retain_days]: crate::model::backup_plan::RetentionPolicy::backup_retain_days
        /// [google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]: crate::model::backup_plan::Schedule::cron_schedule
        pub rpo_config: std::option::Option<crate::model::RpoConfig>,

        /// Output only. Start time of next scheduled backup under this BackupPlan by
        /// either cron_schedule or rpo config.
        pub next_scheduled_backup_time: std::option::Option<wkt::Timestamp>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Schedule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cron_schedule][crate::model::backup_plan::Schedule::cron_schedule].
        pub fn set_cron_schedule<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.cron_schedule = v.into();
            self
        }

        /// Sets the value of [paused][crate::model::backup_plan::Schedule::paused].
        pub fn set_paused<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.paused = v.into();
            self
        }

        /// Sets the value of [rpo_config][crate::model::backup_plan::Schedule::rpo_config].
        pub fn set_rpo_config<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::RpoConfig>,
        {
            self.rpo_config = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [rpo_config][crate::model::backup_plan::Schedule::rpo_config].
        pub fn set_or_clear_rpo_config<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::RpoConfig>,
        {
            self.rpo_config = v.map(|x| x.into());
            self
        }

        /// Sets the value of [next_scheduled_backup_time][crate::model::backup_plan::Schedule::next_scheduled_backup_time].
        pub fn set_next_scheduled_backup_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.next_scheduled_backup_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [next_scheduled_backup_time][crate::model::backup_plan::Schedule::next_scheduled_backup_time].
        pub fn set_or_clear_next_scheduled_backup_time<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.next_scheduled_backup_time = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Schedule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.Schedule"
        }
    }

    /// BackupConfig defines the configuration of Backups created via this
    /// BackupPlan.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct BackupConfig {
        /// Optional. This flag specifies whether volume data should be backed up
        /// when PVCs are included in the scope of a Backup.
        ///
        /// Default: False
        pub include_volume_data: bool,

        /// Optional. This flag specifies whether Kubernetes Secret resources should
        /// be included when they fall into the scope of Backups.
        ///
        /// Default: False
        pub include_secrets: bool,

        /// Optional. This defines a customer managed encryption key that will be
        /// used to encrypt the "config" portion (the Kubernetes resources) of
        /// Backups created via this plan.
        ///
        /// Default (empty): Config backup artifacts will not be encrypted.
        pub encryption_key: std::option::Option<crate::model::EncryptionKey>,

        /// Optional. If false, Backups will fail when Backup for GKE detects
        /// Kubernetes configuration that is non-standard or
        /// requires additional setup to restore.
        ///
        /// Default: False
        pub permissive_mode: bool,

        /// This defines the "scope" of the Backup - which namespaced
        /// resources in the cluster will be included in a Backup.
        /// Exactly one of the fields of backup_scope MUST be specified.
        pub backup_scope:
            std::option::Option<crate::model::backup_plan::backup_config::BackupScope>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl BackupConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [include_volume_data][crate::model::backup_plan::BackupConfig::include_volume_data].
        pub fn set_include_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.include_volume_data = v.into();
            self
        }

        /// Sets the value of [include_secrets][crate::model::backup_plan::BackupConfig::include_secrets].
        pub fn set_include_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.include_secrets = v.into();
            self
        }

        /// Sets the value of [encryption_key][crate::model::backup_plan::BackupConfig::encryption_key].
        pub fn set_encryption_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::EncryptionKey>,
        {
            self.encryption_key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [encryption_key][crate::model::backup_plan::BackupConfig::encryption_key].
        pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::EncryptionKey>,
        {
            self.encryption_key = v.map(|x| x.into());
            self
        }

        /// Sets the value of [permissive_mode][crate::model::backup_plan::BackupConfig::permissive_mode].
        pub fn set_permissive_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.permissive_mode = v.into();
            self
        }

        /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope].
        ///
        /// Note that all the setters affecting `backup_scope` are mutually
        /// exclusive.
        pub fn set_backup_scope<
            T: std::convert::Into<
                    std::option::Option<crate::model::backup_plan::backup_config::BackupScope>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.backup_scope = v.into();
            self
        }

        /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// if it holds a `AllNamespaces`, `None` if the field is not set or
        /// holds a different branch.
        pub fn all_namespaces(&self) -> std::option::Option<&bool> {
            #[allow(unreachable_patterns)]
            self.backup_scope.as_ref().and_then(|v| match v {
                crate::model::backup_plan::backup_config::BackupScope::AllNamespaces(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// to hold a `AllNamespaces`.
        ///
        /// Note that all the setters affecting `backup_scope` are
        /// mutually exclusive.
        pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.backup_scope = std::option::Option::Some(
                crate::model::backup_plan::backup_config::BackupScope::AllNamespaces(v.into()),
            );
            self
        }

        /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
        /// holds a different branch.
        pub fn selected_namespaces(
            &self,
        ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
            #[allow(unreachable_patterns)]
            self.backup_scope.as_ref().and_then(|v| match v {
                crate::model::backup_plan::backup_config::BackupScope::SelectedNamespaces(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// to hold a `SelectedNamespaces`.
        ///
        /// Note that all the setters affecting `backup_scope` are
        /// mutually exclusive.
        pub fn set_selected_namespaces<
            T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.backup_scope = std::option::Option::Some(
                crate::model::backup_plan::backup_config::BackupScope::SelectedNamespaces(v.into()),
            );
            self
        }

        /// The value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// if it holds a `SelectedApplications`, `None` if the field is not set or
        /// holds a different branch.
        pub fn selected_applications(
            &self,
        ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
            #[allow(unreachable_patterns)]
            self.backup_scope.as_ref().and_then(|v| match v {
                crate::model::backup_plan::backup_config::BackupScope::SelectedApplications(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [backup_scope][crate::model::backup_plan::BackupConfig::backup_scope]
        /// to hold a `SelectedApplications`.
        ///
        /// Note that all the setters affecting `backup_scope` are
        /// mutually exclusive.
        pub fn set_selected_applications<
            T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.backup_scope = std::option::Option::Some(
                crate::model::backup_plan::backup_config::BackupScope::SelectedApplications(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for BackupConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlan.BackupConfig"
        }
    }

    /// Defines additional types related to [BackupConfig].
    pub mod backup_config {
        #[allow(unused_imports)]
        use super::*;

        /// This defines the "scope" of the Backup - which namespaced
        /// resources in the cluster will be included in a Backup.
        /// Exactly one of the fields of backup_scope MUST be specified.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum BackupScope {
            /// If True, include all namespaced resources
            AllNamespaces(bool),
            /// If set, include just the resources in the listed namespaces.
            SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
            /// If set, include just the resources referenced by the listed
            /// ProtectedApplications.
            SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
        }
    }

    /// State
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default first value for Enums.
        Unspecified,
        /// Waiting for cluster state to be RUNNING.
        ClusterPending,
        /// The BackupPlan is in the process of being created.
        Provisioning,
        /// The BackupPlan has successfully been created and is ready for Backups.
        Ready,
        /// BackupPlan creation has failed.
        Failed,
        /// The BackupPlan has been deactivated.
        Deactivated,
        /// The BackupPlan is in the process of being deleted.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ClusterPending => std::option::Option::Some(1),
                Self::Provisioning => std::option::Option::Some(2),
                Self::Ready => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Deactivated => std::option::Option::Some(5),
                Self::Deleting => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
                Self::Provisioning => std::option::Option::Some("PROVISIONING"),
                Self::Ready => std::option::Option::Some("READY"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deactivated => std::option::Option::Some("DEACTIVATED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ClusterPending,
                2 => Self::Provisioning,
                3 => Self::Ready,
                4 => Self::Failed,
                5 => Self::Deactivated,
                6 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CLUSTER_PENDING" => Self::ClusterPending,
                "PROVISIONING" => Self::Provisioning,
                "READY" => Self::Ready,
                "FAILED" => Self::Failed,
                "DEACTIVATED" => Self::Deactivated,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ClusterPending => serializer.serialize_i32(1),
                Self::Provisioning => serializer.serialize_i32(2),
                Self::Ready => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Deactivated => serializer.serialize_i32(5),
                Self::Deleting => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.BackupPlan.State",
            ))
        }
    }
}

/// Defines RPO scheduling configuration for automatically creating
/// Backups via this BackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RpoConfig {
    /// Required. Defines the target RPO for the BackupPlan in minutes, which means
    /// the target maximum data loss in time that is acceptable for this
    /// BackupPlan. This must be at least 60, i.e., 1 hour, and at most 86400,
    /// i.e., 60 days.
    pub target_rpo_minutes: i32,

    /// Optional. User specified time windows during which backup can NOT happen
    /// for this BackupPlan - backups should start and finish outside of any given
    /// exclusion window. Note: backup jobs will be scheduled to start and
    /// finish outside the duration of the window as much as possible, but
    /// running jobs will not get canceled when it runs into the window.
    /// All the time and date values in exclusion_windows entry in the API are in
    /// UTC.
    /// We only allow <=1 recurrence (daily or weekly) exclusion window for a
    /// BackupPlan while no restriction on number of single occurrence
    /// windows.
    pub exclusion_windows: std::vec::Vec<crate::model::ExclusionWindow>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RpoConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [target_rpo_minutes][crate::model::RpoConfig::target_rpo_minutes].
    pub fn set_target_rpo_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.target_rpo_minutes = v.into();
        self
    }

    /// Sets the value of [exclusion_windows][crate::model::RpoConfig::exclusion_windows].
    pub fn set_exclusion_windows<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ExclusionWindow>,
    {
        use std::iter::Iterator;
        self.exclusion_windows = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for RpoConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.RpoConfig"
    }
}

/// Defines a time window during which no backup should
/// happen. All time and date are in UTC.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExclusionWindow {
    /// Required. Specifies the start time of the window using time of the day in
    /// UTC.
    pub start_time: std::option::Option<gtype::model::TimeOfDay>,

    /// Required. Specifies duration of the window.
    /// Duration must be >= 5 minutes and < (target RPO - 20 minutes).
    /// Additional restrictions based on the recurrence type to allow some time for
    /// backup to happen:
    ///
    /// - single_occurrence_date:  no restriction, but UI may warn about this when
    ///   duration >= target RPO
    /// - daily window: duration < 24 hours
    /// - weekly window:
    ///   - days of week includes all seven days of a week: duration < 24 hours
    ///   - all other weekly window: duration < 168 hours (i.e., 24 * 7 hours)
    pub duration: std::option::Option<wkt::Duration>,

    /// Required. Specifies the day(s) on which the exclusion window takes
    /// effect. Exactly one of the fields MUST be specified.
    pub recurrence: std::option::Option<crate::model::exclusion_window::Recurrence>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExclusionWindow {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [start_time][crate::model::ExclusionWindow::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::TimeOfDay>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::ExclusionWindow::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::TimeOfDay>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [duration][crate::model::ExclusionWindow::duration].
    pub fn set_duration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.duration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [duration][crate::model::ExclusionWindow::duration].
    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.duration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence].
    ///
    /// Note that all the setters affecting `recurrence` are mutually
    /// exclusive.
    pub fn set_recurrence<
        T: std::convert::Into<std::option::Option<crate::model::exclusion_window::Recurrence>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.recurrence = v.into();
        self
    }

    /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// if it holds a `SingleOccurrenceDate`, `None` if the field is not set or
    /// holds a different branch.
    pub fn single_occurrence_date(
        &self,
    ) -> std::option::Option<&std::boxed::Box<gtype::model::Date>> {
        #[allow(unreachable_patterns)]
        self.recurrence.as_ref().and_then(|v| match v {
            crate::model::exclusion_window::Recurrence::SingleOccurrenceDate(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// to hold a `SingleOccurrenceDate`.
    ///
    /// Note that all the setters affecting `recurrence` are
    /// mutually exclusive.
    pub fn set_single_occurrence_date<
        T: std::convert::Into<std::boxed::Box<gtype::model::Date>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.recurrence = std::option::Option::Some(
            crate::model::exclusion_window::Recurrence::SingleOccurrenceDate(v.into()),
        );
        self
    }

    /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// if it holds a `Daily`, `None` if the field is not set or
    /// holds a different branch.
    pub fn daily(&self) -> std::option::Option<&bool> {
        #[allow(unreachable_patterns)]
        self.recurrence.as_ref().and_then(|v| match v {
            crate::model::exclusion_window::Recurrence::Daily(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// to hold a `Daily`.
    ///
    /// Note that all the setters affecting `recurrence` are
    /// mutually exclusive.
    pub fn set_daily<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.recurrence =
            std::option::Option::Some(crate::model::exclusion_window::Recurrence::Daily(v.into()));
        self
    }

    /// The value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// if it holds a `DaysOfWeek`, `None` if the field is not set or
    /// holds a different branch.
    pub fn days_of_week(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>> {
        #[allow(unreachable_patterns)]
        self.recurrence.as_ref().and_then(|v| match v {
            crate::model::exclusion_window::Recurrence::DaysOfWeek(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [recurrence][crate::model::ExclusionWindow::recurrence]
    /// to hold a `DaysOfWeek`.
    ///
    /// Note that all the setters affecting `recurrence` are
    /// mutually exclusive.
    pub fn set_days_of_week<
        T: std::convert::Into<std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.recurrence = std::option::Option::Some(
            crate::model::exclusion_window::Recurrence::DaysOfWeek(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ExclusionWindow {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ExclusionWindow"
    }
}

/// Defines additional types related to [ExclusionWindow].
pub mod exclusion_window {
    #[allow(unused_imports)]
    use super::*;

    /// Holds repeated DaysOfWeek values as a container.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DayOfWeekList {
        /// Optional. A list of days of week.
        pub days_of_week: std::vec::Vec<gtype::model::DayOfWeek>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DayOfWeekList {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [days_of_week][crate::model::exclusion_window::DayOfWeekList::days_of_week].
        pub fn set_days_of_week<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<gtype::model::DayOfWeek>,
        {
            use std::iter::Iterator;
            self.days_of_week = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for DayOfWeekList {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.ExclusionWindow.DayOfWeekList"
        }
    }

    /// Required. Specifies the day(s) on which the exclusion window takes
    /// effect. Exactly one of the fields MUST be specified.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Recurrence {
        /// No recurrence. The exclusion window occurs only once and on this
        /// date in UTC.
        SingleOccurrenceDate(std::boxed::Box<gtype::model::Date>),
        /// The exclusion window occurs every day if set to "True".
        /// Specifying this field to "False" is an error.
        Daily(bool),
        /// The exclusion window occurs on these days of each week in UTC.
        DaysOfWeek(std::boxed::Box<crate::model::exclusion_window::DayOfWeekList>),
    }
}

/// A BackupPlanBinding binds a BackupPlan with a BackupChannel.
/// This resource is created automatically when a BackupPlan is created using a
/// BackupChannel. This also serves as a holder for cross-project fields
/// that need to be displayed in the current project.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BackupPlanBinding {
    /// Identifier. The fully qualified name of the BackupPlanBinding.
    /// `projects/*/locations/*/backupChannels/*/backupPlanBindings/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
    pub uid: std::string::String,

    /// Output only. The timestamp when this binding was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this binding was created.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Immutable. The fully qualified name of the BackupPlan bound
    /// with the parent BackupChannel.
    /// `projects/*/locations/*/backupPlans/{backup_plan}`
    pub backup_plan: std::string::String,

    /// Output only. Immutable. The fully qualified name of the cluster that is
    /// being backed up Valid formats:
    ///
    /// - `projects/*/locations/*/clusters/*`
    /// - `projects/*/zones/*/clusters/*`
    pub cluster: std::string::String,

    /// Output only. Contains details about the backup plan/backup.
    pub backup_plan_details:
        std::option::Option<crate::model::backup_plan_binding::BackupPlanDetails>,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a BackupPlanBinding from overwriting
    /// each other. It is strongly suggested that systems make use of the 'etag' in
    /// the read-modify-write cycle to perform BackupPlanBinding updates in
    /// order to avoid race conditions: An `etag` is returned in the response to
    /// `GetBackupPlanBinding`, and systems are expected to put that etag in
    /// the request to `UpdateBackupPlanBinding` or
    /// `DeleteBackupPlanBinding` to ensure that their change will be applied
    /// to the same version of the resource.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BackupPlanBinding {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::BackupPlanBinding::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::BackupPlanBinding::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::BackupPlanBinding::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::BackupPlanBinding::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::BackupPlanBinding::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::BackupPlanBinding::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [backup_plan][crate::model::BackupPlanBinding::backup_plan].
    pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_plan = v.into();
        self
    }

    /// Sets the value of [cluster][crate::model::BackupPlanBinding::cluster].
    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.cluster = v.into();
        self
    }

    /// Sets the value of [backup_plan_details][crate::model::BackupPlanBinding::backup_plan_details].
    pub fn set_backup_plan_details<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan_binding::BackupPlanDetails>,
    {
        self.backup_plan_details = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_plan_details][crate::model::BackupPlanBinding::backup_plan_details].
    pub fn set_or_clear_backup_plan_details<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::backup_plan_binding::BackupPlanDetails>,
    {
        self.backup_plan_details = v.map(|x| x.into());
        self
    }

    /// Sets the value of [etag][crate::model::BackupPlanBinding::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for BackupPlanBinding {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding"
    }
}

/// Defines additional types related to [BackupPlanBinding].
pub mod backup_plan_binding {
    #[allow(unused_imports)]
    use super::*;

    /// Contains metadata about the backup plan/backup.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct BackupPlanDetails {
        /// Output only. The number of Kubernetes Pods backed up in the
        /// last successful Backup created via this BackupPlan.
        pub protected_pod_count: i32,

        /// Output only. State of the BackupPlan.
        pub state: crate::model::backup_plan_binding::backup_plan_details::State,

        /// Output only. Completion time of the last successful Backup. This is
        /// sourced from a successful Backup's complete_time field.
        pub last_successful_backup_time: std::option::Option<wkt::Timestamp>,

        /// Output only. Start time of next scheduled backup under this BackupPlan by
        /// either cron_schedule or rpo config. This is sourced from BackupPlan.
        pub next_scheduled_backup_time: std::option::Option<wkt::Timestamp>,

        /// Output only. A number that represents the current risk level of this
        /// BackupPlan from RPO perspective with 1 being no risk and 5 being highest
        /// risk.
        pub rpo_risk_level: i32,

        /// Output only. The fully qualified name of the last successful Backup
        /// created under this BackupPlan.
        /// `projects/*/locations/*/backupPlans/*/backups/*`
        pub last_successful_backup: std::string::String,

        /// Output only. Contains details about the BackupConfig of Backups created
        /// via this BackupPlan.
        pub backup_config_details: std::option::Option<
            crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
        >,

        /// Output only. Contains details about the RetentionPolicy of Backups
        /// created via this BackupPlan.
        pub retention_policy_details: std::option::Option<
            crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
        >,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl BackupPlanDetails {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [protected_pod_count][crate::model::backup_plan_binding::BackupPlanDetails::protected_pod_count].
        pub fn set_protected_pod_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.protected_pod_count = v.into();
            self
        }

        /// Sets the value of [state][crate::model::backup_plan_binding::BackupPlanDetails::state].
        pub fn set_state<
            T: std::convert::Into<crate::model::backup_plan_binding::backup_plan_details::State>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.state = v.into();
            self
        }

        /// Sets the value of [last_successful_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup_time].
        pub fn set_last_successful_backup_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.last_successful_backup_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [last_successful_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup_time].
        pub fn set_or_clear_last_successful_backup_time<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.last_successful_backup_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [next_scheduled_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::next_scheduled_backup_time].
        pub fn set_next_scheduled_backup_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.next_scheduled_backup_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [next_scheduled_backup_time][crate::model::backup_plan_binding::BackupPlanDetails::next_scheduled_backup_time].
        pub fn set_or_clear_next_scheduled_backup_time<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.next_scheduled_backup_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [rpo_risk_level][crate::model::backup_plan_binding::BackupPlanDetails::rpo_risk_level].
        pub fn set_rpo_risk_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.rpo_risk_level = v.into();
            self
        }

        /// Sets the value of [last_successful_backup][crate::model::backup_plan_binding::BackupPlanDetails::last_successful_backup].
        pub fn set_last_successful_backup<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.last_successful_backup = v.into();
            self
        }

        /// Sets the value of [backup_config_details][crate::model::backup_plan_binding::BackupPlanDetails::backup_config_details].
        pub fn set_backup_config_details<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
                >,
        {
            self.backup_config_details = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [backup_config_details][crate::model::backup_plan_binding::BackupPlanDetails::backup_config_details].
        pub fn set_or_clear_backup_config_details<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails,
                >,
        {
            self.backup_config_details = v.map(|x| x.into());
            self
        }

        /// Sets the value of [retention_policy_details][crate::model::backup_plan_binding::BackupPlanDetails::retention_policy_details].
        pub fn set_retention_policy_details<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<
                    crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
                >,
        {
            self.retention_policy_details = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [retention_policy_details][crate::model::backup_plan_binding::BackupPlanDetails::retention_policy_details].
        pub fn set_or_clear_retention_policy_details<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<
                    crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails,
                >,
        {
            self.retention_policy_details = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for BackupPlanDetails {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails"
        }
    }

    /// Defines additional types related to [BackupPlanDetails].
    pub mod backup_plan_details {
        #[allow(unused_imports)]
        use super::*;

        /// BackupConfigDetails defines the configuration of Backups created via this
        /// BackupPlan.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct BackupConfigDetails {

            /// Output only. This flag specifies whether volume data should be backed
            /// up when PVCs are included in the scope of a Backup.
            ///
            /// Default: False
            pub include_volume_data: bool,

            /// Output only. This flag specifies whether Kubernetes Secret resources
            /// should be included when they fall into the scope of Backups.
            ///
            /// Default: False
            pub include_secrets: bool,

            /// Output only. This defines a customer managed encryption key that will
            /// be used to encrypt the "config" portion (the Kubernetes resources) of
            /// Backups created via this plan.
            ///
            /// Default (empty): Config backup artifacts will not be encrypted.
            pub encryption_key: std::option::Option<crate::model::EncryptionKey>,

            /// This defines the "scope" of the Backup - which namespaced
            /// resources in the cluster will be included in a Backup.
            /// Exactly one of the fields of backup_scope MUST be specified.
            pub backup_scope: std::option::Option<crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl BackupConfigDetails {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [include_volume_data][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::include_volume_data].
            pub fn set_include_volume_data<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.include_volume_data = v.into();
                self
            }

            /// Sets the value of [include_secrets][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::include_secrets].
            pub fn set_include_secrets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.include_secrets = v.into();
                self
            }

            /// Sets the value of [encryption_key][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::encryption_key].
            pub fn set_encryption_key<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::EncryptionKey>,
            {
                self.encryption_key = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [encryption_key][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::encryption_key].
            pub fn set_or_clear_encryption_key<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::EncryptionKey>,
            {
                self.encryption_key = v.map(|x| x.into());
                self
            }

            /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope].
            ///
            /// Note that all the setters affecting `backup_scope` are mutually
            /// exclusive.
            pub fn set_backup_scope<T: std::convert::Into<std::option::Option<crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope>>>(mut self, v: T) -> Self
            {
                self.backup_scope = v.into();
                self
            }

            /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// if it holds a `AllNamespaces`, `None` if the field is not set or
            /// holds a different branch.
            pub fn all_namespaces(&self) -> std::option::Option<&bool> {
                #[allow(unreachable_patterns)]
                self.backup_scope.as_ref().and_then(|v| match v {
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::AllNamespaces(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// to hold a `AllNamespaces`.
            ///
            /// Note that all the setters affecting `backup_scope` are
            /// mutually exclusive.
            pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
                self.backup_scope = std::option::Option::Some(
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::AllNamespaces(
                        v.into()
                    )
                );
                self
            }

            /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
            /// holds a different branch.
            pub fn selected_namespaces(
                &self,
            ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
                #[allow(unreachable_patterns)]
                self.backup_scope.as_ref().and_then(|v| match v {
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedNamespaces(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// to hold a `SelectedNamespaces`.
            ///
            /// Note that all the setters affecting `backup_scope` are
            /// mutually exclusive.
            pub fn set_selected_namespaces<
                T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.backup_scope = std::option::Option::Some(
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedNamespaces(
                        v.into()
                    )
                );
                self
            }

            /// The value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// if it holds a `SelectedApplications`, `None` if the field is not set or
            /// holds a different branch.
            pub fn selected_applications(
                &self,
            ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
                #[allow(unreachable_patterns)]
                self.backup_scope.as_ref().and_then(|v| match v {
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedApplications(v) => std::option::Option::Some(v),
                    _ => std::option::Option::None,
                })
            }

            /// Sets the value of [backup_scope][crate::model::backup_plan_binding::backup_plan_details::BackupConfigDetails::backup_scope]
            /// to hold a `SelectedApplications`.
            ///
            /// Note that all the setters affecting `backup_scope` are
            /// mutually exclusive.
            pub fn set_selected_applications<
                T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
            >(
                mut self,
                v: T,
            ) -> Self {
                self.backup_scope = std::option::Option::Some(
                    crate::model::backup_plan_binding::backup_plan_details::backup_config_details::BackupScope::SelectedApplications(
                        v.into()
                    )
                );
                self
            }
        }

        impl wkt::message::Message for BackupConfigDetails {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.BackupConfigDetails"
            }
        }

        /// Defines additional types related to [BackupConfigDetails].
        pub mod backup_config_details {
            #[allow(unused_imports)]
            use super::*;

            /// This defines the "scope" of the Backup - which namespaced
            /// resources in the cluster will be included in a Backup.
            /// Exactly one of the fields of backup_scope MUST be specified.
            #[derive(Clone, Debug, PartialEq)]
            #[non_exhaustive]
            pub enum BackupScope {
                /// Output only. If True, include all namespaced resources
                AllNamespaces(bool),
                /// Output only. If set, include just the resources in the listed
                /// namespaces.
                SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
                /// Output only. If set, include just the resources referenced by the
                /// listed ProtectedApplications.
                SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
            }
        }

        /// RetentionPolicyDetails defines a Backup retention policy for a
        /// BackupPlan.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct RetentionPolicyDetails {
            /// Optional. Minimum age for Backups created via this BackupPlan (in
            /// days). This field MUST be an integer value between 0-90 (inclusive). A
            /// Backup created under this BackupPlan will NOT be deletable until it
            /// reaches Backup's (create_time + backup_delete_lock_days).
            /// Updating this field of a BackupPlan does NOT affect existing Backups
            /// under it. Backups created AFTER a successful update will inherit
            /// the new value.
            ///
            /// Default: 0 (no delete blocking)
            pub backup_delete_lock_days: i32,

            /// Optional. The default maximum age of a Backup created via this
            /// BackupPlan. This field MUST be an integer value >= 0 and <= 365. If
            /// specified, a Backup created under this BackupPlan will be automatically
            /// deleted after its age reaches (create_time + backup_retain_days). If
            /// not specified, Backups created under this BackupPlan will NOT be
            /// subject to automatic deletion.
            /// Default: 0 (no automatic deletion)
            pub backup_retain_days: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl RetentionPolicyDetails {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [backup_delete_lock_days][crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails::backup_delete_lock_days].
            pub fn set_backup_delete_lock_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.backup_delete_lock_days = v.into();
                self
            }

            /// Sets the value of [backup_retain_days][crate::model::backup_plan_binding::backup_plan_details::RetentionPolicyDetails::backup_retain_days].
            pub fn set_backup_retain_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.backup_retain_days = v.into();
                self
            }
        }

        impl wkt::message::Message for RetentionPolicyDetails {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.RetentionPolicyDetails"
            }
        }

        /// State
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum State {
            /// Default first value for Enums.
            Unspecified,
            /// Waiting for cluster state to be RUNNING.
            ClusterPending,
            /// The BackupPlan is in the process of being created.
            Provisioning,
            /// The BackupPlan has successfully been created and is ready for Backups.
            Ready,
            /// BackupPlan creation has failed.
            Failed,
            /// The BackupPlan has been deactivated.
            Deactivated,
            /// The BackupPlan is in the process of being deleted.
            Deleting,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [State::value] or
            /// [State::name].
            UnknownValue(state::UnknownValue),
        }

        #[doc(hidden)]
        pub mod state {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl State {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::ClusterPending => std::option::Option::Some(1),
                    Self::Provisioning => std::option::Option::Some(2),
                    Self::Ready => std::option::Option::Some(3),
                    Self::Failed => std::option::Option::Some(4),
                    Self::Deactivated => std::option::Option::Some(5),
                    Self::Deleting => std::option::Option::Some(6),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                    Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
                    Self::Provisioning => std::option::Option::Some("PROVISIONING"),
                    Self::Ready => std::option::Option::Some("READY"),
                    Self::Failed => std::option::Option::Some("FAILED"),
                    Self::Deactivated => std::option::Option::Some("DEACTIVATED"),
                    Self::Deleting => std::option::Option::Some("DELETING"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for State {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for State {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for State {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::ClusterPending,
                    2 => Self::Provisioning,
                    3 => Self::Ready,
                    4 => Self::Failed,
                    5 => Self::Deactivated,
                    6 => Self::Deleting,
                    _ => Self::UnknownValue(state::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for State {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "STATE_UNSPECIFIED" => Self::Unspecified,
                    "CLUSTER_PENDING" => Self::ClusterPending,
                    "PROVISIONING" => Self::Provisioning,
                    "READY" => Self::Ready,
                    "FAILED" => Self::Failed,
                    "DEACTIVATED" => Self::Deactivated,
                    "DELETING" => Self::Deleting,
                    _ => Self::UnknownValue(state::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for State {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::ClusterPending => serializer.serialize_i32(1),
                    Self::Provisioning => serializer.serialize_i32(2),
                    Self::Ready => serializer.serialize_i32(3),
                    Self::Failed => serializer.serialize_i32(4),
                    Self::Deactivated => serializer.serialize_i32(5),
                    Self::Deleting => serializer.serialize_i32(6),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for State {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                    ".google.cloud.gkebackup.v1.BackupPlanBinding.BackupPlanDetails.State",
                ))
            }
        }
    }
}

/// A list of Kubernetes Namespaces.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Namespaces {
    /// Optional. A list of Kubernetes Namespaces.
    pub namespaces: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Namespaces {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [namespaces][crate::model::Namespaces::namespaces].
    pub fn set_namespaces<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.namespaces = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Namespaces {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.Namespaces"
    }
}

/// A reference to a namespaced resource in Kubernetes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NamespacedName {
    /// Optional. The Namespace of the Kubernetes resource.
    pub namespace: std::string::String,

    /// Optional. The name of the Kubernetes resource.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl NamespacedName {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [namespace][crate::model::NamespacedName::namespace].
    pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.namespace = v.into();
        self
    }

    /// Sets the value of [name][crate::model::NamespacedName::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for NamespacedName {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.NamespacedName"
    }
}

/// A list of namespaced Kubernetes resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NamespacedNames {
    /// Optional. A list of namespaced Kubernetes resources.
    pub namespaced_names: std::vec::Vec<crate::model::NamespacedName>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl NamespacedNames {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [namespaced_names][crate::model::NamespacedNames::namespaced_names].
    pub fn set_namespaced_names<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::NamespacedName>,
    {
        use std::iter::Iterator;
        self.namespaced_names = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for NamespacedNames {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.NamespacedNames"
    }
}

/// Defined a customer managed encryption key that will be used to encrypt Backup
/// artifacts.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EncryptionKey {
    /// Optional. Google Cloud KMS encryption key. Format:
    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`
    pub gcp_kms_encryption_key: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EncryptionKey {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gcp_kms_encryption_key][crate::model::EncryptionKey::gcp_kms_encryption_key].
    pub fn set_gcp_kms_encryption_key<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.gcp_kms_encryption_key = v.into();
        self
    }
}

impl wkt::message::Message for EncryptionKey {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.EncryptionKey"
    }
}

/// Message to encapsulate VolumeType enum.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VolumeTypeEnum {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl VolumeTypeEnum {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for VolumeTypeEnum {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.VolumeTypeEnum"
    }
}

/// Defines additional types related to [VolumeTypeEnum].
pub mod volume_type_enum {
    #[allow(unused_imports)]
    use super::*;

    /// Supported volume types.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum VolumeType {
        /// Default
        Unspecified,
        /// Compute Engine Persistent Disk volume
        GcePersistentDisk,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [VolumeType::value] or
        /// [VolumeType::name].
        UnknownValue(volume_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod volume_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl VolumeType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::GcePersistentDisk => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("VOLUME_TYPE_UNSPECIFIED"),
                Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for VolumeType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for VolumeType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for VolumeType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for VolumeType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "VOLUME_TYPE_UNSPECIFIED" => Self::Unspecified,
                "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for VolumeType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::GcePersistentDisk => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for VolumeType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeType>::new(
                ".google.cloud.gkebackup.v1.VolumeTypeEnum.VolumeType",
            ))
        }
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.OperationMetadata"
    }
}

/// Request message for CreateBackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateBackupPlanRequest {
    /// Required. The location within which to create the BackupPlan.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Required. The BackupPlan resource object to create.
    pub backup_plan: std::option::Option<crate::model::BackupPlan>,

    /// Required. The client-provided short name for the BackupPlan resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of BackupPlans in this location
    pub backup_plan_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateBackupPlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateBackupPlanRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [backup_plan][crate::model::CreateBackupPlanRequest::backup_plan].
    pub fn set_backup_plan<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BackupPlan>,
    {
        self.backup_plan = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_plan][crate::model::CreateBackupPlanRequest::backup_plan].
    pub fn set_or_clear_backup_plan<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BackupPlan>,
    {
        self.backup_plan = v.map(|x| x.into());
        self
    }

    /// Sets the value of [backup_plan_id][crate::model::CreateBackupPlanRequest::backup_plan_id].
    pub fn set_backup_plan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_plan_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateBackupPlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupPlanRequest"
    }
}

/// Request message for ListBackupPlans.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupPlansRequest {
    /// Required. The location that contains the BackupPlans to list.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]: crate::model::ListBackupPlansResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]
    /// received from a previous `ListBackupPlans` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListBackupPlans` must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlansResponse.next_page_token]: crate::model::ListBackupPlansResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupPlansRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListBackupPlansRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListBackupPlansRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListBackupPlansRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListBackupPlansRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListBackupPlansRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListBackupPlansRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlansRequest"
    }
}

/// Response message for ListBackupPlans.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupPlansResponse {
    /// The list of BackupPlans matching the given criteria.
    pub backup_plans: std::vec::Vec<crate::model::BackupPlan>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token]
    /// in a subsequent `ListBackupPlans` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlansRequest.page_token]: crate::model::ListBackupPlansRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupPlansResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup_plans][crate::model::ListBackupPlansResponse::backup_plans].
    pub fn set_backup_plans<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::BackupPlan>,
    {
        use std::iter::Iterator;
        self.backup_plans = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListBackupPlansResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListBackupPlansResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListBackupPlansResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlansResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListBackupPlansResponse {
    type PageItem = crate::model::BackupPlan;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.backup_plans
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetBackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupPlanRequest {
    /// Required. Fully qualified BackupPlan name.
    /// Format: `projects/*/locations/*/backupPlans/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupPlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetBackupPlanRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupPlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupPlanRequest"
    }
}

/// Request message for UpdateBackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateBackupPlanRequest {
    /// Required. A new version of the BackupPlan resource that contains updated
    /// fields. This may be sparsely populated if an `update_mask` is provided.
    pub backup_plan: std::option::Option<crate::model::BackupPlan>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// BackupPlan targeted for update. The values for each of these
    /// updated fields will be taken from the `backup_plan` provided
    /// with this request. Field names are relative to the root of the resource
    /// (e.g., `description`, `backup_config.include_volume_data`, etc.)
    /// If no `update_mask` is provided, all fields in `backup_plan` will be
    /// written to the target BackupPlan resource.
    /// Note that OUTPUT_ONLY and IMMUTABLE fields in `backup_plan` are ignored
    /// and are not used to update the target BackupPlan.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateBackupPlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup_plan][crate::model::UpdateBackupPlanRequest::backup_plan].
    pub fn set_backup_plan<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BackupPlan>,
    {
        self.backup_plan = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_plan][crate::model::UpdateBackupPlanRequest::backup_plan].
    pub fn set_or_clear_backup_plan<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BackupPlan>,
    {
        self.backup_plan = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateBackupPlanRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupPlanRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateBackupPlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupPlanRequest"
    }
}

/// Request message for DeleteBackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteBackupPlanRequest {
    /// Required. Fully qualified BackupPlan name.
    /// Format: `projects/*/locations/*/backupPlans/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target BackupPlan's [etag][google.cloud.gkebackup.v1.BackupPlan.etag] field
    /// or the request is rejected.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan.etag]: crate::model::BackupPlan::etag
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteBackupPlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteBackupPlanRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteBackupPlanRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteBackupPlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupPlanRequest"
    }
}

/// Request message for CreateBackupChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateBackupChannelRequest {
    /// Required. The location within which to create the BackupChannel.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Required. The BackupChannel resource object to create.
    pub backup_channel: std::option::Option<crate::model::BackupChannel>,

    /// Optional. The client-provided short name for the BackupChannel resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of BackupChannels in this location
    ///   If the user does not provide a name, a uuid will be used as the name.
    pub backup_channel_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateBackupChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateBackupChannelRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [backup_channel][crate::model::CreateBackupChannelRequest::backup_channel].
    pub fn set_backup_channel<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BackupChannel>,
    {
        self.backup_channel = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_channel][crate::model::CreateBackupChannelRequest::backup_channel].
    pub fn set_or_clear_backup_channel<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BackupChannel>,
    {
        self.backup_channel = v.map(|x| x.into());
        self
    }

    /// Sets the value of [backup_channel_id][crate::model::CreateBackupChannelRequest::backup_channel_id].
    pub fn set_backup_channel_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.backup_channel_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateBackupChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupChannelRequest"
    }
}

/// Request message for ListBackupChannels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupChannelsRequest {
    /// Required. The location that contains the BackupChannels to list.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]: crate::model::ListBackupChannelsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]
    /// received from a previous `ListBackupChannels` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListBackupChannels` must match the call that provided the page
    /// token.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupChannelsResponse.next_page_token]: crate::model::ListBackupChannelsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupChannelsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListBackupChannelsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListBackupChannelsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListBackupChannelsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListBackupChannelsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListBackupChannelsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListBackupChannelsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupChannelsRequest"
    }
}

/// Response message for ListBackupChannels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupChannelsResponse {
    /// The list of BackupChannels matching the given criteria.
    pub backup_channels: std::vec::Vec<crate::model::BackupChannel>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListBackupChannelsRequest.page_token]
    /// in a subsequent `ListBackupChannels` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupChannelsRequest.page_token]: crate::model::ListBackupChannelsRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupChannelsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup_channels][crate::model::ListBackupChannelsResponse::backup_channels].
    pub fn set_backup_channels<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::BackupChannel>,
    {
        use std::iter::Iterator;
        self.backup_channels = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListBackupChannelsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListBackupChannelsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListBackupChannelsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupChannelsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListBackupChannelsResponse {
    type PageItem = crate::model::BackupChannel;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.backup_channels
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetBackupChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupChannelRequest {
    /// Required. Fully qualified BackupChannel name.
    /// Format: `projects/*/locations/*/backupChannels/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetBackupChannelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupChannelRequest"
    }
}

/// Request message for UpdateBackupChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateBackupChannelRequest {
    /// Required. A new version of the BackupChannel resource that contains updated
    /// fields. This may be sparsely populated if an `update_mask` is provided.
    pub backup_channel: std::option::Option<crate::model::BackupChannel>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// BackupChannel targeted for update. The values for each of these
    /// updated fields will be taken from the `backup_channel` provided
    /// with this request. Field names are relative to the root of the resource
    /// (e.g., `description`, `labels`, etc.)
    /// If no `update_mask` is provided, all fields in `backup_channel` will
    /// be written to the target BackupChannel resource. Note that
    /// OUTPUT_ONLY and IMMUTABLE fields in `backup_channel` are ignored and
    /// are not used to update the target BackupChannel.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateBackupChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup_channel][crate::model::UpdateBackupChannelRequest::backup_channel].
    pub fn set_backup_channel<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BackupChannel>,
    {
        self.backup_channel = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup_channel][crate::model::UpdateBackupChannelRequest::backup_channel].
    pub fn set_or_clear_backup_channel<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BackupChannel>,
    {
        self.backup_channel = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateBackupChannelRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupChannelRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateBackupChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupChannelRequest"
    }
}

/// Request message for DeleteBackupChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteBackupChannelRequest {
    /// Required. Fully qualified BackupChannel name.
    /// Format: `projects/*/locations/*/backupChannels/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target BackupChannel's [etag][google.cloud.gkebackup.v1.BackupChannel.etag]
    /// field or the request is rejected.
    ///
    /// [google.cloud.gkebackup.v1.BackupChannel.etag]: crate::model::BackupChannel::etag
    pub etag: std::string::String,

    /// Optional. If set to true, any BackupPlanAssociations below this
    /// BackupChannel will also be deleted. Otherwise, the request will only
    /// succeed if the BackupChannel has no BackupPlanAssociations.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteBackupChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteBackupChannelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteBackupChannelRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteBackupChannelRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteBackupChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupChannelRequest"
    }
}

/// Request message for ListBackupPlanBindings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupPlanBindingsRequest {
    /// Required. The BackupChannel that contains the BackupPlanBindings to list.
    /// Format: `projects/*/locations/*/backupChannels/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]: crate::model::ListBackupPlanBindingsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]
    /// received from a previous `ListBackupPlanBindings` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListBackupPlanBindings` must match the call that provided the page
    /// token.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse.next_page_token]: crate::model::ListBackupPlanBindingsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupPlanBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListBackupPlanBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListBackupPlanBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListBackupPlanBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListBackupPlanBindingsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListBackupPlanBindingsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListBackupPlanBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest"
    }
}

/// Response message for ListBackupPlanBindings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupPlanBindingsResponse {
    /// The list of BackupPlanBindings matching the given criteria.
    pub backup_plan_bindings: std::vec::Vec<crate::model::BackupPlanBinding>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest.page_token]
    /// in a subsequent `ListBackupPlanBindingss` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupPlanBindingsRequest.page_token]: crate::model::ListBackupPlanBindingsRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupPlanBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup_plan_bindings][crate::model::ListBackupPlanBindingsResponse::backup_plan_bindings].
    pub fn set_backup_plan_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::BackupPlanBinding>,
    {
        use std::iter::Iterator;
        self.backup_plan_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListBackupPlanBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListBackupPlanBindingsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListBackupPlanBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupPlanBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListBackupPlanBindingsResponse {
    type PageItem = crate::model::BackupPlanBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.backup_plan_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetBackupPlanBinding.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupPlanBindingRequest {
    /// Required. Fully qualified BackupPlanBinding name.
    /// Format:
    /// `projects/*/locations/*/backupChannels/*/backupPlanBindings/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupPlanBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetBackupPlanBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupPlanBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupPlanBindingRequest"
    }
}

/// Request message for CreateBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateBackupRequest {
    /// Required. The BackupPlan within which to create the Backup.
    /// Format: `projects/*/locations/*/backupPlans/*`
    pub parent: std::string::String,

    /// Optional. The Backup resource to create.
    pub backup: std::option::Option<crate::model::Backup>,

    /// Optional. The client-provided short name for the Backup resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of Backups in this BackupPlan
    pub backup_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateBackupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
    pub fn set_backup<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Backup>,
    {
        self.backup = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Backup>,
    {
        self.backup = v.map(|x| x.into());
        self
    }

    /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateBackupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateBackupRequest"
    }
}

/// Request message for ListBackups.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupsRequest {
    /// Required. The BackupPlan that contains the Backups to list.
    /// Format: `projects/*/locations/*/backupPlans/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]
    /// received from a previous `ListBackups` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListBackups` must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupsResponse.next_page_token]: crate::model::ListBackupsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    /// Optional. If set to true, the response will return partial results when
    /// some regions are unreachable and the unreachable field will be populated.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListBackupsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListBackupsRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListBackupsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupsRequest"
    }
}

/// Response message for ListBackups.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBackupsResponse {
    /// The list of Backups matching the given criteria.
    pub backups: std::vec::Vec<crate::model::Backup>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListBackupsRequest.page_token] in a
    /// subsequent `ListBackups` call to retrieve the next page of results. If this
    /// field is omitted or empty, then there are no more results to return.
    ///
    /// [google.cloud.gkebackup.v1.ListBackupsRequest.page_token]: crate::model::ListBackupsRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBackupsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
    pub fn set_backups<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Backup>,
    {
        use std::iter::Iterator;
        self.backups = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListBackupsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListBackupsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListBackupsResponse {
    type PageItem = crate::model::Backup;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.backups
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupRequest {
    /// Required. Full name of the Backup resource.
    /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetBackupRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupRequest"
    }
}

/// Request message for UpdateBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateBackupRequest {
    /// Required. A new version of the Backup resource that contains updated
    /// fields. This may be sparsely populated if an `update_mask` is provided.
    pub backup: std::option::Option<crate::model::Backup>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// Backup targeted for update. The values for each of these
    /// updated fields will be taken from the `backup_plan` provided
    /// with this request. Field names are relative to the root of the resource.
    /// If no `update_mask` is provided, all fields in `backup` will be
    /// written to the target Backup resource.
    /// Note that OUTPUT_ONLY and IMMUTABLE fields in `backup` are ignored
    /// and are not used to update the target Backup.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateBackupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
    pub fn set_backup<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Backup>,
    {
        self.backup = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Backup>,
    {
        self.backup = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateBackupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateBackupRequest"
    }
}

/// Request message for DeleteBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteBackupRequest {
    /// Required. Name of the Backup resource.
    /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target Backup's [etag][google.cloud.gkebackup.v1.Backup.etag] field or the
    /// request is rejected.
    ///
    /// [google.cloud.gkebackup.v1.Backup.etag]: crate::model::Backup::etag
    pub etag: std::string::String,

    /// Optional. If set to true, any VolumeBackups below this Backup will also be
    /// deleted. Otherwise, the request will only succeed if the Backup has no
    /// VolumeBackups.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteBackupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteBackupRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteBackupRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteBackupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteBackupRequest"
    }
}

/// Request message for ListVolumeBackups.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVolumeBackupsRequest {
    /// Required. The Backup that contains the VolumeBackups to list.
    /// Format: `projects/*/locations/*/backupPlans/*/backups/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]: crate::model::ListVolumeBackupsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]
    /// received from a previous `ListVolumeBackups` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListVolumeBackups` must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeBackupsResponse.next_page_token]: crate::model::ListVolumeBackupsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVolumeBackupsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListVolumeBackupsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListVolumeBackupsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListVolumeBackupsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListVolumeBackupsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListVolumeBackupsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListVolumeBackupsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeBackupsRequest"
    }
}

/// Response message for ListVolumeBackups.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVolumeBackupsResponse {
    /// The list of VolumeBackups matching the given criteria.
    pub volume_backups: std::vec::Vec<crate::model::VolumeBackup>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token]
    /// in a subsequent `ListVolumeBackups` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeBackupsRequest.page_token]: crate::model::ListVolumeBackupsRequest::page_token
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVolumeBackupsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [volume_backups][crate::model::ListVolumeBackupsResponse::volume_backups].
    pub fn set_volume_backups<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::VolumeBackup>,
    {
        use std::iter::Iterator;
        self.volume_backups = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListVolumeBackupsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListVolumeBackupsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeBackupsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListVolumeBackupsResponse {
    type PageItem = crate::model::VolumeBackup;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.volume_backups
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetVolumeBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetVolumeBackupRequest {
    /// Required. Full name of the VolumeBackup resource.
    /// Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetVolumeBackupRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetVolumeBackupRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetVolumeBackupRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetVolumeBackupRequest"
    }
}

/// Request message for CreateRestorePlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRestorePlanRequest {
    /// Required. The location within which to create the RestorePlan.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Required. The RestorePlan resource object to create.
    pub restore_plan: std::option::Option<crate::model::RestorePlan>,

    /// Required. The client-provided short name for the RestorePlan resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of RestorePlans in this location
    pub restore_plan_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRestorePlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRestorePlanRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [restore_plan][crate::model::CreateRestorePlanRequest::restore_plan].
    pub fn set_restore_plan<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestorePlan>,
    {
        self.restore_plan = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_plan][crate::model::CreateRestorePlanRequest::restore_plan].
    pub fn set_or_clear_restore_plan<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestorePlan>,
    {
        self.restore_plan = v.map(|x| x.into());
        self
    }

    /// Sets the value of [restore_plan_id][crate::model::CreateRestorePlanRequest::restore_plan_id].
    pub fn set_restore_plan_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.restore_plan_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateRestorePlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestorePlanRequest"
    }
}

/// Request message for ListRestorePlans.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestorePlansRequest {
    /// Required. The location that contains the RestorePlans to list.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]: crate::model::ListRestorePlansResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]
    /// received from a previous `ListRestorePlans` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListRestorePlans` must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlansResponse.next_page_token]: crate::model::ListRestorePlansResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestorePlansRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRestorePlansRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRestorePlansRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRestorePlansRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRestorePlansRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRestorePlansRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRestorePlansRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlansRequest"
    }
}

/// Response message for ListRestorePlans.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestorePlansResponse {
    /// The list of RestorePlans matching the given criteria.
    pub restore_plans: std::vec::Vec<crate::model::RestorePlan>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token]
    /// in a subsequent `ListRestorePlans` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlansRequest.page_token]: crate::model::ListRestorePlansRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestorePlansResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore_plans][crate::model::ListRestorePlansResponse::restore_plans].
    pub fn set_restore_plans<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RestorePlan>,
    {
        use std::iter::Iterator;
        self.restore_plans = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRestorePlansResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRestorePlansResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRestorePlansResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlansResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRestorePlansResponse {
    type PageItem = crate::model::RestorePlan;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.restore_plans
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetRestorePlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRestorePlanRequest {
    /// Required. Fully qualified RestorePlan name.
    /// Format: `projects/*/locations/*/restorePlans/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRestorePlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRestorePlanRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRestorePlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetRestorePlanRequest"
    }
}

/// Request message for UpdateRestorePlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRestorePlanRequest {
    /// Required. A new version of the RestorePlan resource that contains updated
    /// fields. This may be sparsely populated if an `update_mask` is provided.
    pub restore_plan: std::option::Option<crate::model::RestorePlan>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// RestorePlan targeted for update. The values for each of these
    /// updated fields will be taken from the `restore_plan` provided
    /// with this request. Field names are relative to the root of the resource.
    /// If no `update_mask` is provided, all fields in `restore_plan` will be
    /// written to the target RestorePlan resource.
    /// Note that OUTPUT_ONLY and IMMUTABLE fields in `restore_plan` are ignored
    /// and are not used to update the target RestorePlan.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRestorePlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore_plan][crate::model::UpdateRestorePlanRequest::restore_plan].
    pub fn set_restore_plan<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestorePlan>,
    {
        self.restore_plan = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_plan][crate::model::UpdateRestorePlanRequest::restore_plan].
    pub fn set_or_clear_restore_plan<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestorePlan>,
    {
        self.restore_plan = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRestorePlanRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRestorePlanRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRestorePlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestorePlanRequest"
    }
}

/// Request message for DeleteRestorePlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRestorePlanRequest {
    /// Required. Fully qualified RestorePlan name.
    /// Format: `projects/*/locations/*/restorePlans/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target RestorePlan's [etag][google.cloud.gkebackup.v1.RestorePlan.etag]
    /// field or the request is rejected.
    ///
    /// [google.cloud.gkebackup.v1.RestorePlan.etag]: crate::model::RestorePlan::etag
    pub etag: std::string::String,

    /// Optional. If set to true, any Restores below this RestorePlan will also be
    /// deleted. Otherwise, the request will only succeed if the RestorePlan has no
    /// Restores.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRestorePlanRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRestorePlanRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteRestorePlanRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteRestorePlanRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRestorePlanRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestorePlanRequest"
    }
}

/// Request message for CreateRestoreChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRestoreChannelRequest {
    /// Required. The location within which to create the RestoreChannel.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Required. The RestoreChannel resource object to create.
    pub restore_channel: std::option::Option<crate::model::RestoreChannel>,

    /// Optional. The client-provided short name for the RestoreChannel resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of RestoreChannels in this location
    ///   If the user does not provide a name, a uuid will be used as the name.
    pub restore_channel_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRestoreChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRestoreChannelRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [restore_channel][crate::model::CreateRestoreChannelRequest::restore_channel].
    pub fn set_restore_channel<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestoreChannel>,
    {
        self.restore_channel = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_channel][crate::model::CreateRestoreChannelRequest::restore_channel].
    pub fn set_or_clear_restore_channel<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestoreChannel>,
    {
        self.restore_channel = v.map(|x| x.into());
        self
    }

    /// Sets the value of [restore_channel_id][crate::model::CreateRestoreChannelRequest::restore_channel_id].
    pub fn set_restore_channel_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.restore_channel_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateRestoreChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestoreChannelRequest"
    }
}

/// Request message for ListRestoreChannels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestoreChannelsRequest {
    /// Required. The location that contains the RestoreChannels to list.
    /// Format: `projects/*/locations/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]: crate::model::ListRestoreChannelsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]
    /// received from a previous `ListRestoreChannels` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListRestoreChannels` must match the call that provided the page
    /// token.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoreChannelsResponse.next_page_token]: crate::model::ListRestoreChannelsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestoreChannelsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRestoreChannelsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRestoreChannelsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRestoreChannelsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRestoreChannelsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRestoreChannelsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRestoreChannelsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoreChannelsRequest"
    }
}

/// Response message for ListRestoreChannels.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestoreChannelsResponse {
    /// The list of RestoreChannels matching the given criteria.
    pub restore_channels: std::vec::Vec<crate::model::RestoreChannel>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListRestoreChannelsRequest.page_token]
    /// in a subsequent `ListRestoreChannels` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoreChannelsRequest.page_token]: crate::model::ListRestoreChannelsRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestoreChannelsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore_channels][crate::model::ListRestoreChannelsResponse::restore_channels].
    pub fn set_restore_channels<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RestoreChannel>,
    {
        use std::iter::Iterator;
        self.restore_channels = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRestoreChannelsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRestoreChannelsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRestoreChannelsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoreChannelsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRestoreChannelsResponse {
    type PageItem = crate::model::RestoreChannel;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.restore_channels
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetRestoreChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRestoreChannelRequest {
    /// Required. Fully qualified RestoreChannel name.
    /// Format: `projects/*/locations/*/restoreChannels/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRestoreChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRestoreChannelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRestoreChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetRestoreChannelRequest"
    }
}

/// Request message for UpdateRestoreChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRestoreChannelRequest {
    /// Required. A new version of the RestoreChannel resource that contains
    /// updated fields. This may be sparsely populated if an `update_mask` is
    /// provided.
    pub restore_channel: std::option::Option<crate::model::RestoreChannel>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// RestoreChannel targeted for update. The values for each of these
    /// updated fields will be taken from the `restore_channel` provided
    /// with this request. Field names are relative to the root of the resource
    /// (e.g., `description`, `destination_project_id`, etc.)
    /// If no `update_mask` is provided, all fields in `restore_channel` will
    /// be written to the target RestoreChannel resource. Note that
    /// OUTPUT_ONLY and IMMUTABLE fields in `restore_channel` are ignored and
    /// are not used to update the target RestoreChannel.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRestoreChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore_channel][crate::model::UpdateRestoreChannelRequest::restore_channel].
    pub fn set_restore_channel<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestoreChannel>,
    {
        self.restore_channel = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_channel][crate::model::UpdateRestoreChannelRequest::restore_channel].
    pub fn set_or_clear_restore_channel<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestoreChannel>,
    {
        self.restore_channel = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRestoreChannelRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRestoreChannelRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRestoreChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestoreChannelRequest"
    }
}

/// Request message for DeleteRestoreChannel.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRestoreChannelRequest {
    /// Required. Fully qualified RestoreChannel name.
    /// Format: `projects/*/locations/*/restoreChannels/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target RestoreChannel's
    /// [etag][google.cloud.gkebackup.v1.RestoreChannel.etag] field or the request
    /// is rejected.
    ///
    /// [google.cloud.gkebackup.v1.RestoreChannel.etag]: crate::model::RestoreChannel::etag
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRestoreChannelRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRestoreChannelRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteRestoreChannelRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRestoreChannelRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestoreChannelRequest"
    }
}

/// Request message for ListRestorePlanBindings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestorePlanBindingsRequest {
    /// Required. The RestoreChannel that contains the ListRestorePlanBindings to
    /// list. Format: `projects/*/locations/*/restoreChannels/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]: crate::model::ListRestorePlanBindingsResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]
    /// received from a previous `ListRestorePlanBindings` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListRestorePlanBindings` must match the call that provided the page
    /// token.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse.next_page_token]: crate::model::ListRestorePlanBindingsResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestorePlanBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRestorePlanBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRestorePlanBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRestorePlanBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRestorePlanBindingsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRestorePlanBindingsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRestorePlanBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest"
    }
}

/// Response message for ListRestorePlanBindings.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestorePlanBindingsResponse {
    /// The list of RestorePlanBindings matching the given criteria.
    pub restore_plan_bindings: std::vec::Vec<crate::model::RestorePlanBinding>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest.page_token]
    /// in a subsequent `ListRestorePlanBindings` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListRestorePlanBindingsRequest.page_token]: crate::model::ListRestorePlanBindingsRequest::page_token
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestorePlanBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore_plan_bindings][crate::model::ListRestorePlanBindingsResponse::restore_plan_bindings].
    pub fn set_restore_plan_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RestorePlanBinding>,
    {
        use std::iter::Iterator;
        self.restore_plan_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRestorePlanBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRestorePlanBindingsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRestorePlanBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestorePlanBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRestorePlanBindingsResponse {
    type PageItem = crate::model::RestorePlanBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.restore_plan_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetRestorePlanBinding.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRestorePlanBindingRequest {
    /// Required. Fully qualified RestorePlanBinding name.
    /// Format:
    /// `projects/*/locations/*/restoreChannels/*/restorePlanBindings/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRestorePlanBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRestorePlanBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRestorePlanBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetRestorePlanBindingRequest"
    }
}

/// Request message for CreateRestore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRestoreRequest {
    /// Required. The RestorePlan within which to create the Restore.
    /// Format: `projects/*/locations/*/restorePlans/*`
    pub parent: std::string::String,

    /// Required. The restore resource to create.
    pub restore: std::option::Option<crate::model::Restore>,

    /// Required. The client-provided short name for the Restore resource.
    /// This name must:
    ///
    /// - be between 1 and 63 characters long (inclusive)
    /// - consist of only lower-case ASCII letters, numbers, and dashes
    /// - start with a lower-case letter
    /// - end with a lower-case letter or number
    /// - be unique within the set of Restores in this RestorePlan.
    pub restore_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRestoreRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRestoreRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [restore][crate::model::CreateRestoreRequest::restore].
    pub fn set_restore<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Restore>,
    {
        self.restore = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore][crate::model::CreateRestoreRequest::restore].
    pub fn set_or_clear_restore<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Restore>,
    {
        self.restore = v.map(|x| x.into());
        self
    }

    /// Sets the value of [restore_id][crate::model::CreateRestoreRequest::restore_id].
    pub fn set_restore_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.restore_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateRestoreRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.CreateRestoreRequest"
    }
}

/// Request message for ListRestores.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestoresRequest {
    /// Required. The RestorePlan that contains the Restores to list.
    /// Format: `projects/*/locations/*/restorePlans/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]: crate::model::ListRestoresResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]
    /// received from a previous `ListRestores` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to `ListRestores`
    /// must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoresResponse.next_page_token]: crate::model::ListRestoresResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestoresRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRestoresRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRestoresRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRestoresRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRestoresRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRestoresRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRestoresRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoresRequest"
    }
}

/// Response message for ListRestores.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRestoresResponse {
    /// The list of Restores matching the given criteria.
    pub restores: std::vec::Vec<crate::model::Restore>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListRestoresRequest.page_token] in a
    /// subsequent `ListRestores` call to retrieve the next page of results. If
    /// this field is omitted or empty, then there are no more results to return.
    ///
    /// [google.cloud.gkebackup.v1.ListRestoresRequest.page_token]: crate::model::ListRestoresRequest::page_token
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRestoresResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restores][crate::model::ListRestoresResponse::restores].
    pub fn set_restores<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Restore>,
    {
        use std::iter::Iterator;
        self.restores = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRestoresResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRestoresResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRestoresResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListRestoresResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRestoresResponse {
    type PageItem = crate::model::Restore;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.restores
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetRestore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRestoreRequest {
    /// Required. Name of the restore resource.
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRestoreRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRestoreRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRestoreRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetRestoreRequest"
    }
}

/// Request message for UpdateRestore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRestoreRequest {
    /// Required. A new version of the Restore resource that contains updated
    /// fields. This may be sparsely populated if an `update_mask` is provided.
    pub restore: std::option::Option<crate::model::Restore>,

    /// Optional. This is used to specify the fields to be overwritten in the
    /// Restore targeted for update. The values for each of these
    /// updated fields will be taken from the `restore` provided
    /// with this request. Field names are relative to the root of the resource.
    /// If no `update_mask` is provided, all fields in `restore` will be
    /// written to the target Restore resource.
    /// Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored
    /// and are not used to update the target Restore.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRestoreRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restore][crate::model::UpdateRestoreRequest::restore].
    pub fn set_restore<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Restore>,
    {
        self.restore = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore][crate::model::UpdateRestoreRequest::restore].
    pub fn set_or_clear_restore<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Restore>,
    {
        self.restore = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRestoreRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRestoreRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRestoreRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.UpdateRestoreRequest"
    }
}

/// Request message for DeleteRestore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRestoreRequest {
    /// Required. Full name of the Restore
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
    pub name: std::string::String,

    /// Optional. If provided, this value must match the current value of the
    /// target Restore's [etag][google.cloud.gkebackup.v1.Restore.etag] field or
    /// the request is rejected.
    ///
    /// [google.cloud.gkebackup.v1.Restore.etag]: crate::model::Restore::etag
    pub etag: std::string::String,

    /// Optional. If set to true, any VolumeRestores below this restore will also
    /// be deleted. Otherwise, the request will only succeed if the restore has no
    /// VolumeRestores.
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRestoreRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRestoreRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteRestoreRequest::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteRestoreRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRestoreRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.DeleteRestoreRequest"
    }
}

/// Request message for ListVolumeRestores.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVolumeRestoresRequest {
    /// Required. The Restore that contains the VolumeRestores to list.
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
    pub parent: std::string::String,

    /// Optional. The target number of results to return in a single response.
    /// If not specified, a default value will be chosen by the service.
    /// Note that the response may include a partial list and a caller should
    /// only rely on the response's
    /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]
    /// to determine if there are more instances left to be queried.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]: crate::model::ListVolumeRestoresResponse::next_page_token
    pub page_size: i32,

    /// Optional. The value of
    /// [next_page_token][google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]
    /// received from a previous `ListVolumeRestores` call.
    /// Provide this to retrieve the subsequent page in a multi-page list of
    /// results. When paginating, all other parameters provided to
    /// `ListVolumeRestores` must match the call that provided the page token.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeRestoresResponse.next_page_token]: crate::model::ListVolumeRestoresResponse::next_page_token
    pub page_token: std::string::String,

    /// Optional. Field match expression used to filter the results.
    pub filter: std::string::String,

    /// Optional. Field by which to sort the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVolumeRestoresRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListVolumeRestoresRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListVolumeRestoresRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListVolumeRestoresRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListVolumeRestoresRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListVolumeRestoresRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListVolumeRestoresRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeRestoresRequest"
    }
}

/// Response message for ListVolumeRestores.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVolumeRestoresResponse {
    /// The list of VolumeRestores matching the given criteria.
    pub volume_restores: std::vec::Vec<crate::model::VolumeRestore>,

    /// A token which may be sent as
    /// [page_token][google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token]
    /// in a subsequent `ListVolumeRestores` call to retrieve the next page of
    /// results. If this field is omitted or empty, then there are no more results
    /// to return.
    ///
    /// [google.cloud.gkebackup.v1.ListVolumeRestoresRequest.page_token]: crate::model::ListVolumeRestoresRequest::page_token
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVolumeRestoresResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [volume_restores][crate::model::ListVolumeRestoresResponse::volume_restores].
    pub fn set_volume_restores<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::VolumeRestore>,
    {
        use std::iter::Iterator;
        self.volume_restores = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListVolumeRestoresResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListVolumeRestoresResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ListVolumeRestoresResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListVolumeRestoresResponse {
    type PageItem = crate::model::VolumeRestore;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.volume_restores
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for GetVolumeRestore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetVolumeRestoreRequest {
    /// Required. Full name of the VolumeRestore resource.
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*`
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetVolumeRestoreRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetVolumeRestoreRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetVolumeRestoreRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetVolumeRestoreRequest"
    }
}

/// Request message for GetBackupIndexDownloadUrl.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupIndexDownloadUrlRequest {
    /// Required. Full name of Backup resource.
    /// Format:
    /// projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}
    pub backup: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupIndexDownloadUrlRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [backup][crate::model::GetBackupIndexDownloadUrlRequest::backup].
    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupIndexDownloadUrlRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupIndexDownloadUrlRequest"
    }
}

/// Response message for GetBackupIndexDownloadUrl.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBackupIndexDownloadUrlResponse {
    /// Required. The signed URL for downloading the backup index.
    pub signed_url: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBackupIndexDownloadUrlResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [signed_url][crate::model::GetBackupIndexDownloadUrlResponse::signed_url].
    pub fn set_signed_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.signed_url = v.into();
        self
    }
}

impl wkt::message::Message for GetBackupIndexDownloadUrlResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.GetBackupIndexDownloadUrlResponse"
    }
}

/// Represents both a request to Restore some portion of a Backup into
/// a target GKE cluster and a record of the restore operation itself.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Restore {
    /// Output only. The full name of the Restore resource.
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this Restore resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this Restore resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User specified descriptive string for this Restore.
    pub description: std::string::String,

    /// Required. Immutable. A reference to the
    /// [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which
    /// this Restore will restore. Note that this Backup must be a sub-resource of
    /// the RestorePlan's
    /// [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan]. Format:
    /// `projects/*/locations/*/backupPlans/*/backups/*`.
    ///
    /// [google.cloud.gkebackup.v1.Backup]: crate::model::Backup
    /// [google.cloud.gkebackup.v1.RestorePlan.backup_plan]: crate::model::RestorePlan::backup_plan
    pub backup: std::string::String,

    /// Output only. The target cluster into which this Restore will restore data.
    /// Valid formats:
    ///
    /// - `projects/*/locations/*/clusters/*`
    /// - `projects/*/zones/*/clusters/*`
    ///
    /// Inherited from parent RestorePlan's
    /// [cluster][google.cloud.gkebackup.v1.RestorePlan.cluster] value.
    ///
    /// [google.cloud.gkebackup.v1.RestorePlan.cluster]: crate::model::RestorePlan::cluster
    pub cluster: std::string::String,

    /// Output only. Configuration of the Restore.  Inherited from parent
    /// RestorePlan's
    /// [restore_config][google.cloud.gkebackup.v1.RestorePlan.restore_config].
    ///
    /// [google.cloud.gkebackup.v1.RestorePlan.restore_config]: crate::model::RestorePlan::restore_config
    pub restore_config: std::option::Option<crate::model::RestoreConfig>,

    /// A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. The current state of the Restore.
    pub state: crate::model::restore::State,

    /// Output only. Human-readable description of why the Restore is in its
    /// current state. This field is only meant for human readability and should
    /// not be used programmatically as this field is not guaranteed to be
    /// consistent.
    pub state_reason: std::string::String,

    /// Output only. Timestamp of when the restore operation completed.
    pub complete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Number of resources restored during the restore execution.
    pub resources_restored_count: i32,

    /// Output only. Number of resources excluded during the restore execution.
    pub resources_excluded_count: i32,

    /// Output only. Number of resources that failed to be restored during the
    /// restore execution.
    pub resources_failed_count: i32,

    /// Output only. Number of volumes restored during the restore execution.
    pub volumes_restored_count: i32,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a restore from overwriting each other.
    /// It is strongly suggested that systems make use of the `etag` in the
    /// read-modify-write cycle to perform restore updates in order to avoid
    /// race conditions: An `etag` is returned in the response to `GetRestore`,
    /// and systems are expected to put that etag in the request to
    /// `UpdateRestore` or `DeleteRestore` to ensure that their change will be
    /// applied to the same version of the resource.
    pub etag: std::string::String,

    /// Optional. Immutable. Filters resources for `Restore`. If not specified, the
    /// scope of the restore will remain the same as defined in the `RestorePlan`.
    /// If this is specified and no resources are matched by the
    /// `inclusion_filters` or everything is excluded by the `exclusion_filters`,
    /// nothing will be restored. This filter can only be specified if the value of
    /// [namespaced_resource_restore_mode][google.cloud.gkebackup.v1.RestoreConfig.namespaced_resource_restore_mode]
    /// is set to `MERGE_SKIP_ON_CONFLICT`, `MERGE_REPLACE_VOLUME_ON_CONFLICT` or
    /// `MERGE_REPLACE_ON_CONFLICT`.
    ///
    /// [google.cloud.gkebackup.v1.RestoreConfig.namespaced_resource_restore_mode]: crate::model::RestoreConfig::namespaced_resource_restore_mode
    pub filter: std::option::Option<crate::model::restore::Filter>,

    /// Optional. Immutable. Overrides the volume data restore policies selected in
    /// the Restore Config for override-scoped resources.
    pub volume_data_restore_policy_overrides:
        std::vec::Vec<crate::model::VolumeDataRestorePolicyOverride>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Restore {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Restore::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::Restore::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Restore::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Restore::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Restore::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Restore::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::Restore::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [backup][crate::model::Restore::backup].
    pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup = v.into();
        self
    }

    /// Sets the value of [cluster][crate::model::Restore::cluster].
    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.cluster = v.into();
        self
    }

    /// Sets the value of [restore_config][crate::model::Restore::restore_config].
    pub fn set_restore_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestoreConfig>,
    {
        self.restore_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_config][crate::model::Restore::restore_config].
    pub fn set_or_clear_restore_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestoreConfig>,
    {
        self.restore_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Restore::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state][crate::model::Restore::state].
    pub fn set_state<T: std::convert::Into<crate::model::restore::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_reason][crate::model::Restore::state_reason].
    pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_reason = v.into();
        self
    }

    /// Sets the value of [complete_time][crate::model::Restore::complete_time].
    pub fn set_complete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [complete_time][crate::model::Restore::complete_time].
    pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resources_restored_count][crate::model::Restore::resources_restored_count].
    pub fn set_resources_restored_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.resources_restored_count = v.into();
        self
    }

    /// Sets the value of [resources_excluded_count][crate::model::Restore::resources_excluded_count].
    pub fn set_resources_excluded_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.resources_excluded_count = v.into();
        self
    }

    /// Sets the value of [resources_failed_count][crate::model::Restore::resources_failed_count].
    pub fn set_resources_failed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.resources_failed_count = v.into();
        self
    }

    /// Sets the value of [volumes_restored_count][crate::model::Restore::volumes_restored_count].
    pub fn set_volumes_restored_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.volumes_restored_count = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::Restore::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::Restore::filter].
    pub fn set_filter<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::restore::Filter>,
    {
        self.filter = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [filter][crate::model::Restore::filter].
    pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::restore::Filter>,
    {
        self.filter = v.map(|x| x.into());
        self
    }

    /// Sets the value of [volume_data_restore_policy_overrides][crate::model::Restore::volume_data_restore_policy_overrides].
    pub fn set_volume_data_restore_policy_overrides<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::VolumeDataRestorePolicyOverride>,
    {
        use std::iter::Iterator;
        self.volume_data_restore_policy_overrides = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Restore {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.Restore"
    }
}

/// Defines additional types related to [Restore].
pub mod restore {
    #[allow(unused_imports)]
    use super::*;

    /// Defines the filter for `Restore`. This filter can be used to further
    /// refine the resource selection of the `Restore` beyond the coarse-grained
    /// scope defined in the `RestorePlan`. `exclusion_filters` take precedence
    /// over `inclusion_filters`. If a resource matches both `inclusion_filters`
    /// and `exclusion_filters`, it will not be restored.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Filter {
        /// Optional. Selects resources for restoration. If specified, only resources
        /// which match `inclusion_filters` will be selected for restoration. A
        /// resource will be selected if it matches any `ResourceSelector` of the
        /// `inclusion_filters`.
        pub inclusion_filters: std::vec::Vec<crate::model::ResourceSelector>,

        /// Optional. Excludes resources from restoration. If specified,
        /// a resource will not be restored if it matches
        /// any `ResourceSelector` of the `exclusion_filters`.
        pub exclusion_filters: std::vec::Vec<crate::model::ResourceSelector>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Filter {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [inclusion_filters][crate::model::restore::Filter::inclusion_filters].
        pub fn set_inclusion_filters<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::ResourceSelector>,
        {
            use std::iter::Iterator;
            self.inclusion_filters = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [exclusion_filters][crate::model::restore::Filter::exclusion_filters].
        pub fn set_exclusion_filters<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::ResourceSelector>,
        {
            use std::iter::Iterator;
            self.exclusion_filters = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for Filter {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.Restore.Filter"
        }
    }

    /// Possible values for state of the Restore.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The Restore resource is in the process of being created.
        Unspecified,
        /// The Restore resource has been created and the associated RestoreJob
        /// Kubernetes resource has been injected into target cluster.
        Creating,
        /// The gkebackup agent in the cluster has begun executing the restore
        /// operation.
        InProgress,
        /// The restore operation has completed successfully. Restored workloads may
        /// not yet be operational.
        Succeeded,
        /// The restore operation has failed.
        Failed,
        /// This Restore resource is in the process of being deleted.
        Deleting,
        /// The Kubernetes resources created by this Restore are being
        /// validated.
        Validating,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::InProgress => std::option::Option::Some(2),
                Self::Succeeded => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Deleting => std::option::Option::Some(5),
                Self::Validating => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Validating => std::option::Option::Some("VALIDATING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::InProgress,
                3 => Self::Succeeded,
                4 => Self::Failed,
                5 => Self::Deleting,
                6 => Self::Validating,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "IN_PROGRESS" => Self::InProgress,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                "VALIDATING" => Self::Validating,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::InProgress => serializer.serialize_i32(2),
                Self::Succeeded => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Deleting => serializer.serialize_i32(5),
                Self::Validating => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.Restore.State",
            ))
        }
    }
}

/// Configuration of a restore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestoreConfig {
    /// Optional. Specifies the mechanism to be used to restore volume data.
    /// Default: VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED (will be treated as
    /// NO_VOLUME_DATA_RESTORATION).
    pub volume_data_restore_policy: crate::model::restore_config::VolumeDataRestorePolicy,

    /// Optional. Defines the behavior for handling the situation where
    /// cluster-scoped resources being restored already exist in the target
    /// cluster. This MUST be set to a value other than
    /// CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED if
    /// [cluster_resource_restore_scope][google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope]
    /// is not empty.
    ///
    /// [google.cloud.gkebackup.v1.RestoreConfig.cluster_resource_restore_scope]: crate::model::RestoreConfig::cluster_resource_restore_scope
    pub cluster_resource_conflict_policy:
        crate::model::restore_config::ClusterResourceConflictPolicy,

    /// Optional. Defines the behavior for handling the situation where sets of
    /// namespaced resources being restored already exist in the target cluster.
    /// This MUST be set to a value other than
    /// NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED.
    pub namespaced_resource_restore_mode:
        crate::model::restore_config::NamespacedResourceRestoreMode,

    /// Optional. Identifies the cluster-scoped resources to restore from the
    /// Backup. Not specifying it means NO cluster resource will be restored.
    pub cluster_resource_restore_scope:
        std::option::Option<crate::model::restore_config::ClusterResourceRestoreScope>,

    /// Optional. A list of transformation rules to be applied against Kubernetes
    /// resources as they are selected for restoration from a Backup. Rules are
    /// executed in order defined - this order matters, as changes made by a rule
    /// may impact the filtering logic of subsequent rules. An empty list means no
    /// substitution will occur.
    pub substitution_rules: std::vec::Vec<crate::model::restore_config::SubstitutionRule>,

    /// Optional. A list of transformation rules to be applied against Kubernetes
    /// resources as they are selected for restoration from a Backup. Rules are
    /// executed in order defined - this order matters, as changes made by a rule
    /// may impact the filtering logic of subsequent rules. An empty list means no
    /// transformation will occur.
    pub transformation_rules: std::vec::Vec<crate::model::restore_config::TransformationRule>,

    /// Optional. A table that binds volumes by their scope to a restore policy.
    /// Bindings must have a unique scope. Any volumes not scoped in the bindings
    /// are subject to the policy defined in volume_data_restore_policy.
    pub volume_data_restore_policy_bindings:
        std::vec::Vec<crate::model::restore_config::VolumeDataRestorePolicyBinding>,

    /// Optional. RestoreOrder contains custom ordering to use on a Restore.
    pub restore_order: std::option::Option<crate::model::restore_config::RestoreOrder>,

    /// Specifies the namespaced resources to restore from the Backup.
    /// Only one of the entries may be specified. If not specified, NO namespaced
    /// resources will be restored.
    ///
    /// Note: Resources will never be restored into *managed* namespaces such as
    /// `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces
    /// are silently skipped when
    /// [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is
    /// selected. Listing them explicitly will result in an error.
    ///
    /// [google.cloud.gkebackup.v1.RestoreConfig.all_namespaces]: crate::model::RestoreConfig::namespaced_resource_restore_scope
    pub namespaced_resource_restore_scope:
        std::option::Option<crate::model::restore_config::NamespacedResourceRestoreScope>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RestoreConfig {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [volume_data_restore_policy][crate::model::RestoreConfig::volume_data_restore_policy].
    pub fn set_volume_data_restore_policy<
        T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.volume_data_restore_policy = v.into();
        self
    }

    /// Sets the value of [cluster_resource_conflict_policy][crate::model::RestoreConfig::cluster_resource_conflict_policy].
    pub fn set_cluster_resource_conflict_policy<
        T: std::convert::Into<crate::model::restore_config::ClusterResourceConflictPolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.cluster_resource_conflict_policy = v.into();
        self
    }

    /// Sets the value of [namespaced_resource_restore_mode][crate::model::RestoreConfig::namespaced_resource_restore_mode].
    pub fn set_namespaced_resource_restore_mode<
        T: std::convert::Into<crate::model::restore_config::NamespacedResourceRestoreMode>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_resource_restore_mode = v.into();
        self
    }

    /// Sets the value of [cluster_resource_restore_scope][crate::model::RestoreConfig::cluster_resource_restore_scope].
    pub fn set_cluster_resource_restore_scope<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::ClusterResourceRestoreScope>,
    {
        self.cluster_resource_restore_scope = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [cluster_resource_restore_scope][crate::model::RestoreConfig::cluster_resource_restore_scope].
    pub fn set_or_clear_cluster_resource_restore_scope<T>(
        mut self,
        v: std::option::Option<T>,
    ) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::ClusterResourceRestoreScope>,
    {
        self.cluster_resource_restore_scope = v.map(|x| x.into());
        self
    }

    /// Sets the value of [substitution_rules][crate::model::RestoreConfig::substitution_rules].
    pub fn set_substitution_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::restore_config::SubstitutionRule>,
    {
        use std::iter::Iterator;
        self.substitution_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [transformation_rules][crate::model::RestoreConfig::transformation_rules].
    pub fn set_transformation_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::restore_config::TransformationRule>,
    {
        use std::iter::Iterator;
        self.transformation_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [volume_data_restore_policy_bindings][crate::model::RestoreConfig::volume_data_restore_policy_bindings].
    pub fn set_volume_data_restore_policy_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicyBinding>,
    {
        use std::iter::Iterator;
        self.volume_data_restore_policy_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [restore_order][crate::model::RestoreConfig::restore_order].
    pub fn set_restore_order<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::RestoreOrder>,
    {
        self.restore_order = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_order][crate::model::RestoreConfig::restore_order].
    pub fn set_or_clear_restore_order<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::RestoreOrder>,
    {
        self.restore_order = v.map(|x| x.into());
        self
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope].
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are mutually
    /// exclusive.
    pub fn set_namespaced_resource_restore_scope<
        T: std::convert::Into<
                std::option::Option<crate::model::restore_config::NamespacedResourceRestoreScope>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_resource_restore_scope = v.into();
        self
    }

    /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// if it holds a `AllNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn all_namespaces(&self) -> std::option::Option<&bool> {
        #[allow(unreachable_patterns)]
        self.namespaced_resource_restore_scope
            .as_ref()
            .and_then(|v| match v {
                crate::model::restore_config::NamespacedResourceRestoreScope::AllNamespaces(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// to hold a `AllNamespaces`.
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are
    /// mutually exclusive.
    pub fn set_all_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.namespaced_resource_restore_scope = std::option::Option::Some(
            crate::model::restore_config::NamespacedResourceRestoreScope::AllNamespaces(v.into()),
        );
        self
    }

    /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// if it holds a `SelectedNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn selected_namespaces(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
        #[allow(unreachable_patterns)]
        self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
            crate::model::restore_config::NamespacedResourceRestoreScope::SelectedNamespaces(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// to hold a `SelectedNamespaces`.
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are
    /// mutually exclusive.
    pub fn set_selected_namespaces<
        T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_resource_restore_scope = std::option::Option::Some(
            crate::model::restore_config::NamespacedResourceRestoreScope::SelectedNamespaces(
                v.into(),
            ),
        );
        self
    }

    /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// if it holds a `SelectedApplications`, `None` if the field is not set or
    /// holds a different branch.
    pub fn selected_applications(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
        #[allow(unreachable_patterns)]
        self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
            crate::model::restore_config::NamespacedResourceRestoreScope::SelectedApplications(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// to hold a `SelectedApplications`.
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are
    /// mutually exclusive.
    pub fn set_selected_applications<
        T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_resource_restore_scope = std::option::Option::Some(
            crate::model::restore_config::NamespacedResourceRestoreScope::SelectedApplications(
                v.into(),
            ),
        );
        self
    }

    /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// if it holds a `NoNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn no_namespaces(&self) -> std::option::Option<&bool> {
        #[allow(unreachable_patterns)]
        self.namespaced_resource_restore_scope
            .as_ref()
            .and_then(|v| match v {
                crate::model::restore_config::NamespacedResourceRestoreScope::NoNamespaces(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// to hold a `NoNamespaces`.
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are
    /// mutually exclusive.
    pub fn set_no_namespaces<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.namespaced_resource_restore_scope = std::option::Option::Some(
            crate::model::restore_config::NamespacedResourceRestoreScope::NoNamespaces(v.into()),
        );
        self
    }

    /// The value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// if it holds a `ExcludedNamespaces`, `None` if the field is not set or
    /// holds a different branch.
    pub fn excluded_namespaces(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::Namespaces>> {
        #[allow(unreachable_patterns)]
        self.namespaced_resource_restore_scope.as_ref().and_then(|v| match v {
            crate::model::restore_config::NamespacedResourceRestoreScope::ExcludedNamespaces(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [namespaced_resource_restore_scope][crate::model::RestoreConfig::namespaced_resource_restore_scope]
    /// to hold a `ExcludedNamespaces`.
    ///
    /// Note that all the setters affecting `namespaced_resource_restore_scope` are
    /// mutually exclusive.
    pub fn set_excluded_namespaces<
        T: std::convert::Into<std::boxed::Box<crate::model::Namespaces>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.namespaced_resource_restore_scope = std::option::Option::Some(
            crate::model::restore_config::NamespacedResourceRestoreScope::ExcludedNamespaces(
                v.into(),
            ),
        );
        self
    }
}

impl wkt::message::Message for RestoreConfig {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig"
    }
}

/// Defines additional types related to [RestoreConfig].
pub mod restore_config {
    #[allow(unused_imports)]
    use super::*;

    /// This is a direct map to the Kubernetes GroupKind type
    /// [GroupKind](https://godoc.org/k8s.io/apimachinery/pkg/runtime/schema#GroupKind)
    /// and is used for identifying specific "types" of resources to restore.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct GroupKind {
        /// Optional. API group string of a Kubernetes resource, e.g.
        /// "apiextensions.k8s.io", "storage.k8s.io", etc.
        /// Note: use empty string for core API group.
        pub resource_group: std::string::String,

        /// Optional. Kind of a Kubernetes resource, must be in UpperCamelCase
        /// (PascalCase) and singular form. E.g. "CustomResourceDefinition",
        /// "StorageClass", etc.
        pub resource_kind: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl GroupKind {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [resource_group][crate::model::restore_config::GroupKind::resource_group].
        pub fn set_resource_group<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.resource_group = v.into();
            self
        }

        /// Sets the value of [resource_kind][crate::model::restore_config::GroupKind::resource_kind].
        pub fn set_resource_kind<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.resource_kind = v.into();
            self
        }
    }

    impl wkt::message::Message for GroupKind {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.GroupKind"
        }
    }

    /// Defines the scope of cluster-scoped resources to restore.
    ///
    /// Some group kinds are not reasonable choices for a restore, and will cause
    /// an error if selected here. Any scope selection that would restore
    /// "all valid" resources automatically excludes these group kinds.
    ///
    /// - Node
    /// - ComponentStatus
    /// - gkebackup.gke.io/BackupJob
    /// - gkebackup.gke.io/RestoreJob
    /// - metrics.k8s.io/NodeMetrics
    /// - migration.k8s.io/StorageState
    /// - migration.k8s.io/StorageVersionMigration
    /// - snapshot.storage.k8s.io/VolumeSnapshotContent
    /// - storage.k8s.io/CSINode
    /// - storage.k8s.io/VolumeAttachment
    ///
    /// Some group kinds are driven by restore configuration elsewhere,
    /// and will cause an error if selected here.
    ///
    /// - Namespace
    /// - PersistentVolume
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ClusterResourceRestoreScope {
        /// Optional. A list of cluster-scoped resource group kinds to restore from
        /// the backup. If specified, only the selected resources will be restored.
        /// Mutually exclusive to any other field in the message.
        pub selected_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,

        /// Optional. A list of cluster-scoped resource group kinds to NOT restore
        /// from the backup. If specified, all valid cluster-scoped resources will be
        /// restored except for those specified in the list.
        /// Mutually exclusive to any other field in the message.
        pub excluded_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,

        /// Optional. If True, all valid cluster-scoped resources will be restored.
        /// Mutually exclusive to any other field in the message.
        pub all_group_kinds: bool,

        /// Optional. If True, no cluster-scoped resources will be restored.
        /// This has the same restore scope as if the message is not defined.
        /// Mutually exclusive to any other field in the message.
        pub no_group_kinds: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ClusterResourceRestoreScope {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [selected_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::selected_group_kinds].
        pub fn set_selected_group_kinds<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::GroupKind>,
        {
            use std::iter::Iterator;
            self.selected_group_kinds = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [excluded_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::excluded_group_kinds].
        pub fn set_excluded_group_kinds<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::GroupKind>,
        {
            use std::iter::Iterator;
            self.excluded_group_kinds = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [all_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::all_group_kinds].
        pub fn set_all_group_kinds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.all_group_kinds = v.into();
            self
        }

        /// Sets the value of [no_group_kinds][crate::model::restore_config::ClusterResourceRestoreScope::no_group_kinds].
        pub fn set_no_group_kinds<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.no_group_kinds = v.into();
            self
        }
    }

    impl wkt::message::Message for ClusterResourceRestoreScope {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceRestoreScope"
        }
    }

    /// A transformation rule to be applied against Kubernetes resources as they
    /// are selected for restoration from a Backup. A rule contains both filtering
    /// logic (which resources are subject to substitution) and substitution logic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct SubstitutionRule {
        /// Optional. (Filtering parameter) Any resource subject to substitution must
        /// be contained within one of the listed Kubernetes Namespace in the Backup.
        /// If this field is not provided, no namespace filtering will be performed
        /// (all resources in all Namespaces, including all cluster-scoped resources,
        /// will be candidates for substitution).
        /// To mix cluster-scoped and namespaced resources in the same rule, use an
        /// empty string ("") as one of the target namespaces.
        pub target_namespaces: std::vec::Vec<std::string::String>,

        /// Optional. (Filtering parameter) Any resource subject to substitution must
        /// belong to one of the listed "types". If this field is not provided, no
        /// type filtering will be performed (all resources of all types matching
        /// previous filtering parameters will be candidates for substitution).
        pub target_group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,

        /// Required. This is a [JSONPath]
        /// (<https://kubernetes.io/docs/reference/kubectl/jsonpath/>)
        /// expression that matches specific fields of candidate
        /// resources and it operates as both a filtering parameter (resources that
        /// are not matched with this expression will not be candidates for
        /// substitution) as well as a field identifier (identifies exactly which
        /// fields out of the candidate resources will be modified).
        pub target_json_path: std::string::String,

        /// Optional. (Filtering parameter) This is a [regular expression]
        /// (<https://en.wikipedia.org/wiki/Regular_expression>)
        /// that is compared against the fields matched by the target_json_path
        /// expression (and must also have passed the previous filters).
        /// Substitution will not be performed against fields whose
        /// value does not match this expression. If this field is NOT specified,
        /// then ALL fields matched by the target_json_path expression will undergo
        /// substitution. Note that an empty (e.g., "", rather than unspecified)
        /// value for this field will only match empty fields.
        pub original_value_pattern: std::string::String,

        /// Optional. This is the new value to set for any fields that pass the
        /// filtering and selection criteria. To remove a value from a Kubernetes
        /// resource, either leave this field unspecified, or set it to the empty
        /// string ("").
        pub new_value: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl SubstitutionRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [target_namespaces][crate::model::restore_config::SubstitutionRule::target_namespaces].
        pub fn set_target_namespaces<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.target_namespaces = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [target_group_kinds][crate::model::restore_config::SubstitutionRule::target_group_kinds].
        pub fn set_target_group_kinds<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::GroupKind>,
        {
            use std::iter::Iterator;
            self.target_group_kinds = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [target_json_path][crate::model::restore_config::SubstitutionRule::target_json_path].
        pub fn set_target_json_path<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.target_json_path = v.into();
            self
        }

        /// Sets the value of [original_value_pattern][crate::model::restore_config::SubstitutionRule::original_value_pattern].
        pub fn set_original_value_pattern<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.original_value_pattern = v.into();
            self
        }

        /// Sets the value of [new_value][crate::model::restore_config::SubstitutionRule::new_value].
        pub fn set_new_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.new_value = v.into();
            self
        }
    }

    impl wkt::message::Message for SubstitutionRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.SubstitutionRule"
        }
    }

    /// TransformationRuleAction defines a TransformationRule action based on the
    /// JSON Patch RFC (<https://www.rfc-editor.org/rfc/rfc6902>)
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TransformationRuleAction {
        /// Required. op specifies the operation to perform.
        pub op: crate::model::restore_config::transformation_rule_action::Op,

        /// Optional. A string containing a JSON Pointer value that references the
        /// location in the target document to move the value from.
        pub from_path: std::string::String,

        /// Optional. A string containing a JSON-Pointer value that references a
        /// location within the target document where the operation is performed.
        pub path: std::string::String,

        /// Optional. A string that specifies the desired value in string format to
        /// use for transformation.
        pub value: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TransformationRuleAction {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [op][crate::model::restore_config::TransformationRuleAction::op].
        pub fn set_op<
            T: std::convert::Into<crate::model::restore_config::transformation_rule_action::Op>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.op = v.into();
            self
        }

        /// Sets the value of [from_path][crate::model::restore_config::TransformationRuleAction::from_path].
        pub fn set_from_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.from_path = v.into();
            self
        }

        /// Sets the value of [path][crate::model::restore_config::TransformationRuleAction::path].
        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.path = v.into();
            self
        }

        /// Sets the value of [value][crate::model::restore_config::TransformationRuleAction::value].
        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.value = v.into();
            self
        }
    }

    impl wkt::message::Message for TransformationRuleAction {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.TransformationRuleAction"
        }
    }

    /// Defines additional types related to [TransformationRuleAction].
    pub mod transformation_rule_action {
        #[allow(unused_imports)]
        use super::*;

        /// Possible values for operations of a transformation rule action.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Op {
            /// Unspecified operation
            Unspecified,
            /// The "remove" operation removes the value at the target location.
            Remove,
            /// The "move" operation removes the value at a specified location and
            /// adds it to the target location.
            Move,
            /// The "copy" operation copies the value at a specified location to the
            /// target location.
            Copy,
            /// The "add" operation performs one of the following functions,
            /// depending upon what the target location references:
            ///
            /// 1. If the target location specifies an array index, a new value is
            ///    inserted into the array at the specified index.
            /// 1. If the target location specifies an object member that does not
            ///    already exist, a new member is added to the object.
            /// 1. If the target location specifies an object member that does exist,
            ///    that member's value is replaced.
            Add,
            /// The "test" operation tests that a value at the target location is
            /// equal to a specified value.
            Test,
            /// The "replace" operation replaces the value at the target location
            /// with a new value.  The operation object MUST contain a "value" member
            /// whose content specifies the replacement value.
            Replace,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [Op::value] or
            /// [Op::name].
            UnknownValue(op::UnknownValue),
        }

        #[doc(hidden)]
        pub mod op {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl Op {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Remove => std::option::Option::Some(1),
                    Self::Move => std::option::Option::Some(2),
                    Self::Copy => std::option::Option::Some(3),
                    Self::Add => std::option::Option::Some(4),
                    Self::Test => std::option::Option::Some(5),
                    Self::Replace => std::option::Option::Some(6),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("OP_UNSPECIFIED"),
                    Self::Remove => std::option::Option::Some("REMOVE"),
                    Self::Move => std::option::Option::Some("MOVE"),
                    Self::Copy => std::option::Option::Some("COPY"),
                    Self::Add => std::option::Option::Some("ADD"),
                    Self::Test => std::option::Option::Some("TEST"),
                    Self::Replace => std::option::Option::Some("REPLACE"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for Op {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for Op {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for Op {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Remove,
                    2 => Self::Move,
                    3 => Self::Copy,
                    4 => Self::Add,
                    5 => Self::Test,
                    6 => Self::Replace,
                    _ => Self::UnknownValue(op::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for Op {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "OP_UNSPECIFIED" => Self::Unspecified,
                    "REMOVE" => Self::Remove,
                    "MOVE" => Self::Move,
                    "COPY" => Self::Copy,
                    "ADD" => Self::Add,
                    "TEST" => Self::Test,
                    "REPLACE" => Self::Replace,
                    _ => Self::UnknownValue(op::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for Op {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Remove => serializer.serialize_i32(1),
                    Self::Move => serializer.serialize_i32(2),
                    Self::Copy => serializer.serialize_i32(3),
                    Self::Add => serializer.serialize_i32(4),
                    Self::Test => serializer.serialize_i32(5),
                    Self::Replace => serializer.serialize_i32(6),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for Op {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Op>::new(
                    ".google.cloud.gkebackup.v1.RestoreConfig.TransformationRuleAction.Op",
                ))
            }
        }
    }

    /// ResourceFilter specifies matching criteria to limit the scope of a
    /// change to a specific set of kubernetes resources that are selected for
    /// restoration from a backup.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ResourceFilter {
        /// Optional. (Filtering parameter) Any resource subject to transformation
        /// must be contained within one of the listed Kubernetes Namespace in the
        /// Backup. If this field is not provided, no namespace filtering will be
        /// performed (all resources in all Namespaces, including all cluster-scoped
        /// resources, will be candidates for transformation).
        pub namespaces: std::vec::Vec<std::string::String>,

        /// Optional. (Filtering parameter) Any resource subject to transformation
        /// must belong to one of the listed "types". If this field is not provided,
        /// no type filtering will be performed (all resources of all types matching
        /// previous filtering parameters will be candidates for transformation).
        pub group_kinds: std::vec::Vec<crate::model::restore_config::GroupKind>,

        /// Optional. This is a [JSONPath]
        /// (<https://github.com/json-path/JsonPath/blob/master/README.md>)
        /// expression that matches specific fields of candidate
        /// resources and it operates as a filtering parameter (resources that
        /// are not matched with this expression will not be candidates for
        /// transformation).
        pub json_path: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ResourceFilter {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [namespaces][crate::model::restore_config::ResourceFilter::namespaces].
        pub fn set_namespaces<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.namespaces = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [group_kinds][crate::model::restore_config::ResourceFilter::group_kinds].
        pub fn set_group_kinds<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::GroupKind>,
        {
            use std::iter::Iterator;
            self.group_kinds = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [json_path][crate::model::restore_config::ResourceFilter::json_path].
        pub fn set_json_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.json_path = v.into();
            self
        }
    }

    impl wkt::message::Message for ResourceFilter {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.ResourceFilter"
        }
    }

    /// A transformation rule to be applied against Kubernetes resources as they
    /// are selected for restoration from a Backup. A rule contains both filtering
    /// logic (which resources are subject to transform) and transformation logic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TransformationRule {
        /// Required. A list of transformation rule actions to take against candidate
        /// resources. Actions are executed in order defined - this order matters, as
        /// they could potentially interfere with each other and the first operation
        /// could affect the outcome of the second operation.
        pub field_actions: std::vec::Vec<crate::model::restore_config::TransformationRuleAction>,

        /// Optional. This field is used to specify a set of fields that should be
        /// used to determine which resources in backup should be acted upon by the
        /// supplied transformation rule actions, and this will ensure that only
        /// specific resources are affected by transformation rule actions.
        pub resource_filter: std::option::Option<crate::model::restore_config::ResourceFilter>,

        /// Optional. The description is a user specified string description of the
        /// transformation rule.
        pub description: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TransformationRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [field_actions][crate::model::restore_config::TransformationRule::field_actions].
        pub fn set_field_actions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::TransformationRuleAction>,
        {
            use std::iter::Iterator;
            self.field_actions = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [resource_filter][crate::model::restore_config::TransformationRule::resource_filter].
        pub fn set_resource_filter<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::restore_config::ResourceFilter>,
        {
            self.resource_filter = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [resource_filter][crate::model::restore_config::TransformationRule::resource_filter].
        pub fn set_or_clear_resource_filter<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::restore_config::ResourceFilter>,
        {
            self.resource_filter = v.map(|x| x.into());
            self
        }

        /// Sets the value of [description][crate::model::restore_config::TransformationRule::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }
    }

    impl wkt::message::Message for TransformationRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.TransformationRule"
        }
    }

    /// Binds resources in the scope to the given VolumeDataRestorePolicy.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct VolumeDataRestorePolicyBinding {
        /// Required. The VolumeDataRestorePolicy to apply when restoring volumes in
        /// scope.
        pub policy: crate::model::restore_config::VolumeDataRestorePolicy,

        pub scope: std::option::Option<
            crate::model::restore_config::volume_data_restore_policy_binding::Scope,
        >,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl VolumeDataRestorePolicyBinding {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [policy][crate::model::restore_config::VolumeDataRestorePolicyBinding::policy].
        pub fn set_policy<
            T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.policy = v.into();
            self
        }

        /// Sets the value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope].
        ///
        /// Note that all the setters affecting `scope` are mutually
        /// exclusive.
        pub fn set_scope<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::restore_config::volume_data_restore_policy_binding::Scope,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.scope = v.into();
            self
        }

        /// The value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope]
        /// if it holds a `VolumeType`, `None` if the field is not set or
        /// holds a different branch.
        pub fn volume_type(
            &self,
        ) -> std::option::Option<&crate::model::volume_type_enum::VolumeType> {
            #[allow(unreachable_patterns)]
            self.scope.as_ref().and_then(|v| match v {
                crate::model::restore_config::volume_data_restore_policy_binding::Scope::VolumeType(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [scope][crate::model::restore_config::VolumeDataRestorePolicyBinding::scope]
        /// to hold a `VolumeType`.
        ///
        /// Note that all the setters affecting `scope` are
        /// mutually exclusive.
        pub fn set_volume_type<
            T: std::convert::Into<crate::model::volume_type_enum::VolumeType>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.scope = std::option::Option::Some(
                crate::model::restore_config::volume_data_restore_policy_binding::Scope::VolumeType(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for VolumeDataRestorePolicyBinding {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicyBinding"
        }
    }

    /// Defines additional types related to [VolumeDataRestorePolicyBinding].
    pub mod volume_data_restore_policy_binding {
        #[allow(unused_imports)]
        use super::*;

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Scope {
            /// The volume type, as determined by the PVC's bound PV,
            /// to apply the policy to.
            VolumeType(crate::model::volume_type_enum::VolumeType),
        }
    }

    /// Allows customers to specify dependencies between resources
    /// that Backup for GKE can use to compute a resasonable restore order.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RestoreOrder {
        /// Optional. Contains a list of group kind dependency pairs provided
        /// by the customer, that is used by Backup for GKE to
        /// generate a group kind restore order.
        pub group_kind_dependencies:
            std::vec::Vec<crate::model::restore_config::restore_order::GroupKindDependency>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RestoreOrder {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [group_kind_dependencies][crate::model::restore_config::RestoreOrder::group_kind_dependencies].
        pub fn set_group_kind_dependencies<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::restore_config::restore_order::GroupKindDependency>,
        {
            use std::iter::Iterator;
            self.group_kind_dependencies = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for RestoreOrder {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.RestoreOrder"
        }
    }

    /// Defines additional types related to [RestoreOrder].
    pub mod restore_order {
        #[allow(unused_imports)]
        use super::*;

        /// Defines a dependency between two group kinds.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct GroupKindDependency {
            /// Required. The satisfying group kind must be restored first
            /// in order to satisfy the dependency.
            pub satisfying: std::option::Option<crate::model::restore_config::GroupKind>,

            /// Required. The requiring group kind requires that the other
            /// group kind be restored first.
            pub requiring: std::option::Option<crate::model::restore_config::GroupKind>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl GroupKindDependency {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [satisfying][crate::model::restore_config::restore_order::GroupKindDependency::satisfying].
            pub fn set_satisfying<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::restore_config::GroupKind>,
            {
                self.satisfying = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [satisfying][crate::model::restore_config::restore_order::GroupKindDependency::satisfying].
            pub fn set_or_clear_satisfying<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::restore_config::GroupKind>,
            {
                self.satisfying = v.map(|x| x.into());
                self
            }

            /// Sets the value of [requiring][crate::model::restore_config::restore_order::GroupKindDependency::requiring].
            pub fn set_requiring<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<crate::model::restore_config::GroupKind>,
            {
                self.requiring = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [requiring][crate::model::restore_config::restore_order::GroupKindDependency::requiring].
            pub fn set_or_clear_requiring<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<crate::model::restore_config::GroupKind>,
            {
                self.requiring = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for GroupKindDependency {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.gkebackup.v1.RestoreConfig.RestoreOrder.GroupKindDependency"
            }
        }
    }

    /// Defines how volume data should be restored.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum VolumeDataRestorePolicy {
        /// Unspecified (illegal).
        Unspecified,
        /// For each PVC to be restored, create a new underlying volume and PV
        /// from the corresponding VolumeBackup contained within the Backup.
        RestoreVolumeDataFromBackup,
        /// For each PVC to be restored, attempt to reuse the original PV contained
        /// in the Backup (with its original underlying volume). This option
        /// is likely only usable when restoring a workload to its original cluster.
        ReuseVolumeHandleFromBackup,
        /// For each PVC to be restored, create PVC without any particular
        /// action to restore data. In this case, the normal Kubernetes provisioning
        /// logic would kick in, and this would likely result in either dynamically
        /// provisioning blank PVs or binding to statically provisioned PVs.
        NoVolumeDataRestoration,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [VolumeDataRestorePolicy::value] or
        /// [VolumeDataRestorePolicy::name].
        UnknownValue(volume_data_restore_policy::UnknownValue),
    }

    #[doc(hidden)]
    pub mod volume_data_restore_policy {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl VolumeDataRestorePolicy {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::RestoreVolumeDataFromBackup => std::option::Option::Some(1),
                Self::ReuseVolumeHandleFromBackup => std::option::Option::Some(2),
                Self::NoVolumeDataRestoration => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => {
                    std::option::Option::Some("VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED")
                }
                Self::RestoreVolumeDataFromBackup => {
                    std::option::Option::Some("RESTORE_VOLUME_DATA_FROM_BACKUP")
                }
                Self::ReuseVolumeHandleFromBackup => {
                    std::option::Option::Some("REUSE_VOLUME_HANDLE_FROM_BACKUP")
                }
                Self::NoVolumeDataRestoration => {
                    std::option::Option::Some("NO_VOLUME_DATA_RESTORATION")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for VolumeDataRestorePolicy {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for VolumeDataRestorePolicy {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for VolumeDataRestorePolicy {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::RestoreVolumeDataFromBackup,
                2 => Self::ReuseVolumeHandleFromBackup,
                3 => Self::NoVolumeDataRestoration,
                _ => Self::UnknownValue(volume_data_restore_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for VolumeDataRestorePolicy {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "VOLUME_DATA_RESTORE_POLICY_UNSPECIFIED" => Self::Unspecified,
                "RESTORE_VOLUME_DATA_FROM_BACKUP" => Self::RestoreVolumeDataFromBackup,
                "REUSE_VOLUME_HANDLE_FROM_BACKUP" => Self::ReuseVolumeHandleFromBackup,
                "NO_VOLUME_DATA_RESTORATION" => Self::NoVolumeDataRestoration,
                _ => Self::UnknownValue(volume_data_restore_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for VolumeDataRestorePolicy {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::RestoreVolumeDataFromBackup => serializer.serialize_i32(1),
                Self::ReuseVolumeHandleFromBackup => serializer.serialize_i32(2),
                Self::NoVolumeDataRestoration => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for VolumeDataRestorePolicy {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(
                wkt::internal::EnumVisitor::<VolumeDataRestorePolicy>::new(
                    ".google.cloud.gkebackup.v1.RestoreConfig.VolumeDataRestorePolicy",
                ),
            )
        }
    }

    /// Defines the behavior for handling the situation where cluster-scoped
    /// resources being restored already exist in the target cluster.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ClusterResourceConflictPolicy {
        /// Unspecified. Only allowed if no cluster-scoped resources will be
        /// restored.
        Unspecified,
        /// Do not attempt to restore the conflicting resource.
        UseExistingVersion,
        /// Delete the existing version before re-creating it from the Backup.
        /// This is a dangerous option which could cause unintentional
        /// data loss if used inappropriately. For example, deleting a CRD will
        /// cause Kubernetes to delete all CRs of that type.
        UseBackupVersion,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [ClusterResourceConflictPolicy::value] or
        /// [ClusterResourceConflictPolicy::name].
        UnknownValue(cluster_resource_conflict_policy::UnknownValue),
    }

    #[doc(hidden)]
    pub mod cluster_resource_conflict_policy {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl ClusterResourceConflictPolicy {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::UseExistingVersion => std::option::Option::Some(1),
                Self::UseBackupVersion => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => {
                    std::option::Option::Some("CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED")
                }
                Self::UseExistingVersion => std::option::Option::Some("USE_EXISTING_VERSION"),
                Self::UseBackupVersion => std::option::Option::Some("USE_BACKUP_VERSION"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for ClusterResourceConflictPolicy {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for ClusterResourceConflictPolicy {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for ClusterResourceConflictPolicy {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::UseExistingVersion,
                2 => Self::UseBackupVersion,
                _ => Self::UnknownValue(cluster_resource_conflict_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for ClusterResourceConflictPolicy {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "CLUSTER_RESOURCE_CONFLICT_POLICY_UNSPECIFIED" => Self::Unspecified,
                "USE_EXISTING_VERSION" => Self::UseExistingVersion,
                "USE_BACKUP_VERSION" => Self::UseBackupVersion,
                _ => Self::UnknownValue(cluster_resource_conflict_policy::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for ClusterResourceConflictPolicy {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::UseExistingVersion => serializer.serialize_i32(1),
                Self::UseBackupVersion => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for ClusterResourceConflictPolicy {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(
                wkt::internal::EnumVisitor::<ClusterResourceConflictPolicy>::new(
                    ".google.cloud.gkebackup.v1.RestoreConfig.ClusterResourceConflictPolicy",
                ),
            )
        }
    }

    /// Defines the behavior for handling the situation where sets of namespaced
    /// resources being restored already exist in the target cluster.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum NamespacedResourceRestoreMode {
        /// Unspecified (invalid).
        Unspecified,
        /// When conflicting top-level resources (either Namespaces or
        /// ProtectedApplications, depending upon the scope) are encountered, this
        /// will first trigger a delete of the conflicting resource AND ALL OF ITS
        /// REFERENCED RESOURCES (e.g., all resources in the Namespace or all
        /// resources referenced by the ProtectedApplication) before restoring the
        /// resources from the Backup. This mode should only be used when you are
        /// intending to revert some portion of a cluster to an earlier state.
        DeleteAndRestore,
        /// If conflicting top-level resources (either Namespaces or
        /// ProtectedApplications, depending upon the scope) are encountered at the
        /// beginning of a restore process, the Restore will fail.  If a conflict
        /// occurs during the restore process itself (e.g., because an out of band
        /// process creates conflicting resources), a conflict will be reported.
        FailOnConflict,
        /// This mode merges the backup and the target cluster and skips the
        /// conflicting resources. If a single resource to restore exists in the
        /// cluster before restoration, the resource will be skipped, otherwise it
        /// will be restored.
        MergeSkipOnConflict,
        /// This mode merges the backup and the target cluster and skips the
        /// conflicting resources except volume data. If a PVC to restore already
        /// exists, this mode will restore/reconnect the volume without overwriting
        /// the PVC. It is similar to MERGE_SKIP_ON_CONFLICT except that it will
        /// apply the volume data policy for the conflicting PVCs:
        ///
        /// - RESTORE_VOLUME_DATA_FROM_BACKUP: restore data only and respect the
        ///   reclaim policy of the original PV;
        /// - REUSE_VOLUME_HANDLE_FROM_BACKUP: reconnect and respect the reclaim
        ///   policy of the original PV;
        /// - NO_VOLUME_DATA_RESTORATION: new provision and respect the reclaim
        ///   policy of the original PV.
        ///   Note that this mode could cause data loss as the original PV can be
        ///   retained or deleted depending on its reclaim policy.
        MergeReplaceVolumeOnConflict,
        /// This mode merges the backup and the target cluster and replaces the
        /// conflicting resources with the ones in the backup. If a single resource
        /// to restore exists in the cluster before restoration, the resource will be
        /// replaced with the one from the backup. To replace an existing resource,
        /// the first attempt is to update the resource to match the one from the
        /// backup; if the update fails, the second attempt is to delete the resource
        /// and restore it from the backup.
        /// Note that this mode could cause data loss as it replaces the existing
        /// resources in the target cluster, and the original PV can be retained or
        /// deleted depending on its reclaim policy.
        MergeReplaceOnConflict,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [NamespacedResourceRestoreMode::value] or
        /// [NamespacedResourceRestoreMode::name].
        UnknownValue(namespaced_resource_restore_mode::UnknownValue),
    }

    #[doc(hidden)]
    pub mod namespaced_resource_restore_mode {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl NamespacedResourceRestoreMode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::DeleteAndRestore => std::option::Option::Some(1),
                Self::FailOnConflict => std::option::Option::Some(2),
                Self::MergeSkipOnConflict => std::option::Option::Some(3),
                Self::MergeReplaceVolumeOnConflict => std::option::Option::Some(4),
                Self::MergeReplaceOnConflict => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => {
                    std::option::Option::Some("NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED")
                }
                Self::DeleteAndRestore => std::option::Option::Some("DELETE_AND_RESTORE"),
                Self::FailOnConflict => std::option::Option::Some("FAIL_ON_CONFLICT"),
                Self::MergeSkipOnConflict => std::option::Option::Some("MERGE_SKIP_ON_CONFLICT"),
                Self::MergeReplaceVolumeOnConflict => {
                    std::option::Option::Some("MERGE_REPLACE_VOLUME_ON_CONFLICT")
                }
                Self::MergeReplaceOnConflict => {
                    std::option::Option::Some("MERGE_REPLACE_ON_CONFLICT")
                }
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for NamespacedResourceRestoreMode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for NamespacedResourceRestoreMode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for NamespacedResourceRestoreMode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::DeleteAndRestore,
                2 => Self::FailOnConflict,
                3 => Self::MergeSkipOnConflict,
                4 => Self::MergeReplaceVolumeOnConflict,
                5 => Self::MergeReplaceOnConflict,
                _ => Self::UnknownValue(namespaced_resource_restore_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for NamespacedResourceRestoreMode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "NAMESPACED_RESOURCE_RESTORE_MODE_UNSPECIFIED" => Self::Unspecified,
                "DELETE_AND_RESTORE" => Self::DeleteAndRestore,
                "FAIL_ON_CONFLICT" => Self::FailOnConflict,
                "MERGE_SKIP_ON_CONFLICT" => Self::MergeSkipOnConflict,
                "MERGE_REPLACE_VOLUME_ON_CONFLICT" => Self::MergeReplaceVolumeOnConflict,
                "MERGE_REPLACE_ON_CONFLICT" => Self::MergeReplaceOnConflict,
                _ => Self::UnknownValue(namespaced_resource_restore_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for NamespacedResourceRestoreMode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::DeleteAndRestore => serializer.serialize_i32(1),
                Self::FailOnConflict => serializer.serialize_i32(2),
                Self::MergeSkipOnConflict => serializer.serialize_i32(3),
                Self::MergeReplaceVolumeOnConflict => serializer.serialize_i32(4),
                Self::MergeReplaceOnConflict => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for NamespacedResourceRestoreMode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(
                wkt::internal::EnumVisitor::<NamespacedResourceRestoreMode>::new(
                    ".google.cloud.gkebackup.v1.RestoreConfig.NamespacedResourceRestoreMode",
                ),
            )
        }
    }

    /// Specifies the namespaced resources to restore from the Backup.
    /// Only one of the entries may be specified. If not specified, NO namespaced
    /// resources will be restored.
    ///
    /// Note: Resources will never be restored into *managed* namespaces such as
    /// `kube-system`, `kube-public`, or `kube-node-lease`. These namespaces
    /// are silently skipped when
    /// [all_namespaces][google.cloud.gkebackup.v1.RestoreConfig.all_namespaces] is
    /// selected. Listing them explicitly will result in an error.
    ///
    /// [google.cloud.gkebackup.v1.RestoreConfig.all_namespaces]: crate::model::RestoreConfig::namespaced_resource_restore_scope
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum NamespacedResourceRestoreScope {
        /// Restore all namespaced resources in the Backup if set to "True".
        /// Specifying this field to "False" is an error.
        AllNamespaces(bool),
        /// A list of selected Namespaces to restore from the Backup. The listed
        /// Namespaces and all resources contained in them will be restored.
        SelectedNamespaces(std::boxed::Box<crate::model::Namespaces>),
        /// A list of selected ProtectedApplications to restore. The listed
        /// ProtectedApplications and all the resources to which they refer will be
        /// restored.
        SelectedApplications(std::boxed::Box<crate::model::NamespacedNames>),
        /// Do not restore any namespaced resources if set to "True".
        /// Specifying this field to "False" is not allowed.
        NoNamespaces(bool),
        /// A list of selected namespaces excluded from restoration. All
        /// namespaces except those in this list will be restored.
        ExcludedNamespaces(std::boxed::Box<crate::model::Namespaces>),
    }
}

/// Defines a selector to identify a single or a group of resources.
/// Conditions in the selector are optional, but at least one field
/// should be set to a non-empty value. If a condition is not specified,
/// no restrictions will be applied on that dimension.
/// If more than one condition is specified, a resource will be selected
/// if and only if all conditions are met.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceSelector {
    /// Optional. Selects resources using their Kubernetes GroupKinds. If
    /// specified, only resources of provided GroupKind will be selected.
    pub group_kind: std::option::Option<crate::model::restore_config::GroupKind>,

    /// Optional. Selects resources using their resource names. If specified,
    /// only resources with the provided name will be selected.
    pub name: std::string::String,

    /// Optional. Selects resources using their namespaces. This only applies to
    /// namespace scoped resources and cannot be used for selecting
    /// cluster scoped resources. If specified, only resources in the provided
    /// namespace will be selected. If not specified, the filter will apply to
    /// both cluster scoped and namespace scoped resources (e.g. name or label).
    /// The [Namespace](https://pkg.go.dev/k8s.io/api/core/v1#Namespace) resource
    /// itself will be restored if and only if any resources within the namespace
    /// are restored.
    pub namespace: std::string::String,

    /// Optional. Selects resources using Kubernetes
    /// [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/).
    /// If specified, a resource will be selected if and only if the resource
    /// has all of the provided labels and all the label values match.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceSelector {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [group_kind][crate::model::ResourceSelector::group_kind].
    pub fn set_group_kind<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::GroupKind>,
    {
        self.group_kind = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [group_kind][crate::model::ResourceSelector::group_kind].
    pub fn set_or_clear_group_kind<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::restore_config::GroupKind>,
    {
        self.group_kind = v.map(|x| x.into());
        self
    }

    /// Sets the value of [name][crate::model::ResourceSelector::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [namespace][crate::model::ResourceSelector::namespace].
    pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.namespace = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::ResourceSelector::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for ResourceSelector {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.ResourceSelector"
    }
}

/// Defines an override to apply a VolumeDataRestorePolicy for scoped resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VolumeDataRestorePolicyOverride {
    /// Required. The VolumeDataRestorePolicy to apply when restoring volumes in
    /// scope.
    pub policy: crate::model::restore_config::VolumeDataRestorePolicy,

    pub scope: std::option::Option<crate::model::volume_data_restore_policy_override::Scope>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl VolumeDataRestorePolicyOverride {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [policy][crate::model::VolumeDataRestorePolicyOverride::policy].
    pub fn set_policy<
        T: std::convert::Into<crate::model::restore_config::VolumeDataRestorePolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.policy = v.into();
        self
    }

    /// Sets the value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope].
    ///
    /// Note that all the setters affecting `scope` are mutually
    /// exclusive.
    pub fn set_scope<
        T: std::convert::Into<
                std::option::Option<crate::model::volume_data_restore_policy_override::Scope>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.scope = v.into();
        self
    }

    /// The value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope]
    /// if it holds a `SelectedPvcs`, `None` if the field is not set or
    /// holds a different branch.
    pub fn selected_pvcs(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::NamespacedNames>> {
        #[allow(unreachable_patterns)]
        self.scope.as_ref().and_then(|v| match v {
            crate::model::volume_data_restore_policy_override::Scope::SelectedPvcs(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [scope][crate::model::VolumeDataRestorePolicyOverride::scope]
    /// to hold a `SelectedPvcs`.
    ///
    /// Note that all the setters affecting `scope` are
    /// mutually exclusive.
    pub fn set_selected_pvcs<
        T: std::convert::Into<std::boxed::Box<crate::model::NamespacedNames>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.scope = std::option::Option::Some(
            crate::model::volume_data_restore_policy_override::Scope::SelectedPvcs(v.into()),
        );
        self
    }
}

impl wkt::message::Message for VolumeDataRestorePolicyOverride {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.VolumeDataRestorePolicyOverride"
    }
}

/// Defines additional types related to [VolumeDataRestorePolicyOverride].
pub mod volume_data_restore_policy_override {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Scope {
        /// A list of PVCs to apply the policy override to.
        SelectedPvcs(std::boxed::Box<crate::model::NamespacedNames>),
    }
}

/// A RestoreChannel imposes constraints on where backups can be restored.
/// The RestoreChannel should be in the same project and region
/// as the backups. The backups can only be restored in the
/// `destination_project`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestoreChannel {
    /// Identifier. The fully qualified name of the RestoreChannel.
    /// `projects/*/locations/*/restoreChannels/*`
    pub name: std::string::String,

    /// Required. Immutable. The project into which the backups will be restored.
    /// The format is `projects/{projectId}` or `projects/{projectNumber}`.
    pub destination_project: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this RestoreChannel was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this RestoreChannel was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. User specified descriptive string for this RestoreChannel.
    pub description: std::string::String,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a RestoreChannel from overwriting each
    /// other. It is strongly suggested that systems make use of the 'etag' in the
    /// read-modify-write cycle to perform RestoreChannel updates in order to
    /// avoid race conditions: An `etag` is returned in the response to
    /// `GetRestoreChannel`, and systems are expected to put that etag in the
    /// request to `UpdateRestoreChannel` or `DeleteRestoreChannel` to
    /// ensure that their change will be applied to the same version of the
    /// resource.
    pub etag: std::string::String,

    /// Output only. The project_id where backups will be restored.
    /// Example Project ID: "my-project-id".
    /// This will be an OUTPUT_ONLY field to return the project_id of the
    /// destination project.
    pub destination_project_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RestoreChannel {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RestoreChannel::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination_project][crate::model::RestoreChannel::destination_project].
    pub fn set_destination_project<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_project = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::RestoreChannel::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::RestoreChannel::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::RestoreChannel::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::RestoreChannel::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::RestoreChannel::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::RestoreChannel::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::RestoreChannel::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::RestoreChannel::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [destination_project_id][crate::model::RestoreChannel::destination_project_id].
    pub fn set_destination_project_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_project_id = v.into();
        self
    }
}

impl wkt::message::Message for RestoreChannel {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.RestoreChannel"
    }
}

/// The configuration of a potential series of Restore operations to be performed
/// against Backups belong to a particular BackupPlan.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestorePlan {
    /// Output only. The full name of the RestorePlan resource.
    /// Format: `projects/*/locations/*/restorePlans/*`.
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this RestorePlan resource was
    /// created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this RestorePlan resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. User specified descriptive string for this RestorePlan.
    pub description: std::string::String,

    /// Required. Immutable. A reference to the
    /// [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may
    /// be used as the source for Restores created via this RestorePlan. Format:
    /// `projects/*/locations/*/backupPlans/*`.
    ///
    /// [google.cloud.gkebackup.v1.BackupPlan]: crate::model::BackupPlan
    pub backup_plan: std::string::String,

    /// Required. Immutable. The target cluster into which Restores created via
    /// this RestorePlan will restore data. NOTE: the cluster's region must be the
    /// same as the RestorePlan. Valid formats:
    ///
    /// - `projects/*/locations/*/clusters/*`
    /// - `projects/*/zones/*/clusters/*`
    pub cluster: std::string::String,

    /// Required. Configuration of Restores created via this RestorePlan.
    pub restore_config: std::option::Option<crate::model::RestoreConfig>,

    /// Optional. A set of custom labels supplied by user.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a restore from overwriting each other.
    /// It is strongly suggested that systems make use of the `etag` in the
    /// read-modify-write cycle to perform restore updates in order to avoid
    /// race conditions: An `etag` is returned in the response to `GetRestorePlan`,
    /// and systems are expected to put that etag in the request to
    /// `UpdateRestorePlan` or `DeleteRestorePlan` to ensure that their change
    /// will be applied to the same version of the resource.
    pub etag: std::string::String,

    /// Output only. State of the RestorePlan. This State field reflects the
    /// various stages a RestorePlan can be in
    /// during the Create operation.
    pub state: crate::model::restore_plan::State,

    /// Output only. Human-readable description of why RestorePlan is in the
    /// current `state`. This field is only meant for human readability and should
    /// not be used programmatically as this field is not guaranteed to be
    /// consistent.
    pub state_reason: std::string::String,

    /// Output only. The fully qualified name of the RestoreChannel to be used to
    /// create a RestorePlan. This field is set only if the `backup_plan` is in a
    /// different project than the RestorePlan. Format:
    /// `projects/*/locations/*/restoreChannels/*`
    pub restore_channel: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RestorePlan {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RestorePlan::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::RestorePlan::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::RestorePlan::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::RestorePlan::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::RestorePlan::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::RestorePlan::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::RestorePlan::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [backup_plan][crate::model::RestorePlan::backup_plan].
    pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_plan = v.into();
        self
    }

    /// Sets the value of [cluster][crate::model::RestorePlan::cluster].
    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.cluster = v.into();
        self
    }

    /// Sets the value of [restore_config][crate::model::RestorePlan::restore_config].
    pub fn set_restore_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RestoreConfig>,
    {
        self.restore_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restore_config][crate::model::RestorePlan::restore_config].
    pub fn set_or_clear_restore_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RestoreConfig>,
    {
        self.restore_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::RestorePlan::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [etag][crate::model::RestorePlan::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [state][crate::model::RestorePlan::state].
    pub fn set_state<T: std::convert::Into<crate::model::restore_plan::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_reason][crate::model::RestorePlan::state_reason].
    pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_reason = v.into();
        self
    }

    /// Sets the value of [restore_channel][crate::model::RestorePlan::restore_channel].
    pub fn set_restore_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.restore_channel = v.into();
        self
    }
}

impl wkt::message::Message for RestorePlan {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.RestorePlan"
    }
}

/// Defines additional types related to [RestorePlan].
pub mod restore_plan {
    #[allow(unused_imports)]
    use super::*;

    /// State
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Default first value for Enums.
        Unspecified,
        /// Waiting for cluster state to be RUNNING.
        ClusterPending,
        /// The RestorePlan has successfully been created and is ready for Restores.
        Ready,
        /// RestorePlan creation has failed.
        Failed,
        /// The RestorePlan is in the process of being deleted.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ClusterPending => std::option::Option::Some(1),
                Self::Ready => std::option::Option::Some(2),
                Self::Failed => std::option::Option::Some(3),
                Self::Deleting => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::ClusterPending => std::option::Option::Some("CLUSTER_PENDING"),
                Self::Ready => std::option::Option::Some("READY"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ClusterPending,
                2 => Self::Ready,
                3 => Self::Failed,
                4 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CLUSTER_PENDING" => Self::ClusterPending,
                "READY" => Self::Ready,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ClusterPending => serializer.serialize_i32(1),
                Self::Ready => serializer.serialize_i32(2),
                Self::Failed => serializer.serialize_i32(3),
                Self::Deleting => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.RestorePlan.State",
            ))
        }
    }
}

/// A RestorePlanBinding binds a RestorePlan with a RestoreChannel.
/// This resource is created automatically when a RestorePlan is created using a
/// RestoreChannel. This also serves as a holder for cross-project fields
/// that need to be displayed in the current project.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestorePlanBinding {
    /// Identifier. The fully qualified name of the RestorePlanBinding.
    /// `projects/*/locations/*/restoreChannels/*/restorePlanBindings/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID4](https://en.wikipedia.org/wiki/Universally_unique_identifier)
    pub uid: std::string::String,

    /// Output only. The timestamp when this binding was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this binding was created.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The fully qualified name of the RestorePlan bound to this
    /// RestoreChannel. `projects/*/locations/*/restorePlans/{restore_plan}`
    pub restore_plan: std::string::String,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a RestorePlanBinding from overwriting
    /// each other. It is strongly suggested that systems make use of the 'etag' in
    /// the read-modify-write cycle to perform RestorePlanBinding updates in
    /// order to avoid race conditions: An `etag` is returned in the response to
    /// `GetRestorePlanBinding`, and systems are expected to put that etag in
    /// the request to `UpdateRestorePlanBinding` or
    /// `DeleteRestorePlanBinding` to ensure that their change will be applied
    /// to the same version of the resource.
    pub etag: std::string::String,

    /// Output only. The fully qualified name of the BackupPlan bound to the
    /// specified RestorePlan. `projects/*/locations/*/backukpPlans/{backup_plan}`
    pub backup_plan: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RestorePlanBinding {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RestorePlanBinding::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::RestorePlanBinding::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::RestorePlanBinding::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::RestorePlanBinding::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::RestorePlanBinding::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::RestorePlanBinding::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [restore_plan][crate::model::RestorePlanBinding::restore_plan].
    pub fn set_restore_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.restore_plan = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::RestorePlanBinding::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [backup_plan][crate::model::RestorePlanBinding::backup_plan].
    pub fn set_backup_plan<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.backup_plan = v.into();
        self
    }
}

impl wkt::message::Message for RestorePlanBinding {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.RestorePlanBinding"
    }
}

/// Represents the backup of a specific persistent volume as a component of a
/// Backup - both the record of the operation and a pointer to the underlying
/// storage-specific artifacts.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VolumeBackup {
    /// Output only. The full name of the VolumeBackup resource.
    /// Format: `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this VolumeBackup resource was
    /// created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this VolumeBackup resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. A reference to the source Kubernetes PVC from which this
    /// VolumeBackup was created.
    pub source_pvc: std::option::Option<crate::model::NamespacedName>,

    /// Output only. A storage system-specific opaque handle to the underlying
    /// volume backup.
    pub volume_backup_handle: std::string::String,

    /// Output only. The format used for the volume backup.
    pub format: crate::model::volume_backup::VolumeBackupFormat,

    /// Output only. The aggregate size of the underlying artifacts associated with
    /// this VolumeBackup in the backup storage. This may change over time when
    /// multiple backups of the same volume share the same backup storage
    /// location. In particular, this is likely to increase in size when
    /// the immediately preceding backup of the same volume is deleted.
    pub storage_bytes: i64,

    /// Output only. The minimum size of the disk to which this VolumeBackup can be
    /// restored.
    pub disk_size_bytes: i64,

    /// Output only. The timestamp when the associated underlying volume backup
    /// operation completed.
    pub complete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The current state of this VolumeBackup.
    pub state: crate::model::volume_backup::State,

    /// Output only. A human readable message explaining why the VolumeBackup is in
    /// its current state. This field is only meant for human consumption and
    /// should not be used programmatically as this field is not guaranteed to be
    /// consistent.
    pub state_message: std::string::String,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a volume backup from overwriting each
    /// other. It is strongly suggested that systems make use of the `etag` in the
    /// read-modify-write cycle to perform volume backup updates in order to avoid
    /// race conditions.
    pub etag: std::string::String,

    /// Output only. [Output Only] Reserved for future use.
    pub satisfies_pzs: bool,

    /// Output only. [Output Only] Reserved for future use.
    pub satisfies_pzi: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl VolumeBackup {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::VolumeBackup::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::VolumeBackup::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::VolumeBackup::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::VolumeBackup::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::VolumeBackup::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::VolumeBackup::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source_pvc][crate::model::VolumeBackup::source_pvc].
    pub fn set_source_pvc<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::NamespacedName>,
    {
        self.source_pvc = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [source_pvc][crate::model::VolumeBackup::source_pvc].
    pub fn set_or_clear_source_pvc<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::NamespacedName>,
    {
        self.source_pvc = v.map(|x| x.into());
        self
    }

    /// Sets the value of [volume_backup_handle][crate::model::VolumeBackup::volume_backup_handle].
    pub fn set_volume_backup_handle<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.volume_backup_handle = v.into();
        self
    }

    /// Sets the value of [format][crate::model::VolumeBackup::format].
    pub fn set_format<T: std::convert::Into<crate::model::volume_backup::VolumeBackupFormat>>(
        mut self,
        v: T,
    ) -> Self {
        self.format = v.into();
        self
    }

    /// Sets the value of [storage_bytes][crate::model::VolumeBackup::storage_bytes].
    pub fn set_storage_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.storage_bytes = v.into();
        self
    }

    /// Sets the value of [disk_size_bytes][crate::model::VolumeBackup::disk_size_bytes].
    pub fn set_disk_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.disk_size_bytes = v.into();
        self
    }

    /// Sets the value of [complete_time][crate::model::VolumeBackup::complete_time].
    pub fn set_complete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [complete_time][crate::model::VolumeBackup::complete_time].
    pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::VolumeBackup::state].
    pub fn set_state<T: std::convert::Into<crate::model::volume_backup::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::VolumeBackup::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::VolumeBackup::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [satisfies_pzs][crate::model::VolumeBackup::satisfies_pzs].
    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzs = v.into();
        self
    }

    /// Sets the value of [satisfies_pzi][crate::model::VolumeBackup::satisfies_pzi].
    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.satisfies_pzi = v.into();
        self
    }
}

impl wkt::message::Message for VolumeBackup {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.VolumeBackup"
    }
}

/// Defines additional types related to [VolumeBackup].
pub mod volume_backup {
    #[allow(unused_imports)]
    use super::*;

    /// Identifies the format used for the volume backup.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum VolumeBackupFormat {
        /// Default value, not specified.
        Unspecified,
        /// Compute Engine Persistent Disk snapshot based volume backup.
        GcePersistentDisk,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [VolumeBackupFormat::value] or
        /// [VolumeBackupFormat::name].
        UnknownValue(volume_backup_format::UnknownValue),
    }

    #[doc(hidden)]
    pub mod volume_backup_format {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl VolumeBackupFormat {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::GcePersistentDisk => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("VOLUME_BACKUP_FORMAT_UNSPECIFIED"),
                Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for VolumeBackupFormat {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for VolumeBackupFormat {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for VolumeBackupFormat {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_backup_format::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for VolumeBackupFormat {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "VOLUME_BACKUP_FORMAT_UNSPECIFIED" => Self::Unspecified,
                "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_backup_format::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for VolumeBackupFormat {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::GcePersistentDisk => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for VolumeBackupFormat {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeBackupFormat>::new(
                ".google.cloud.gkebackup.v1.VolumeBackup.VolumeBackupFormat",
            ))
        }
    }

    /// The current state of a VolumeBackup
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// This is an illegal state and should not be encountered.
        Unspecified,
        /// A volume for the backup was identified and backup process is about to
        /// start.
        Creating,
        /// The volume backup operation has begun and is in the initial "snapshot"
        /// phase of the process. Any defined ProtectedApplication "pre" hooks will
        /// be executed before entering this state and "post" hooks will be executed
        /// upon leaving this state.
        Snapshotting,
        /// The snapshot phase of the volume backup operation has completed and
        /// the snapshot is now being uploaded to backup storage.
        Uploading,
        /// The volume backup operation has completed successfully.
        Succeeded,
        /// The volume backup operation has failed.
        Failed,
        /// This VolumeBackup resource (and its associated artifacts) is in the
        /// process of being deleted.
        Deleting,
        /// The underlying artifacts of a volume backup (eg: persistent disk
        /// snapshots) are deleted.
        CleanedUp,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Snapshotting => std::option::Option::Some(2),
                Self::Uploading => std::option::Option::Some(3),
                Self::Succeeded => std::option::Option::Some(4),
                Self::Failed => std::option::Option::Some(5),
                Self::Deleting => std::option::Option::Some(6),
                Self::CleanedUp => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Snapshotting => std::option::Option::Some("SNAPSHOTTING"),
                Self::Uploading => std::option::Option::Some("UPLOADING"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::CleanedUp => std::option::Option::Some("CLEANED_UP"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Snapshotting,
                3 => Self::Uploading,
                4 => Self::Succeeded,
                5 => Self::Failed,
                6 => Self::Deleting,
                7 => Self::CleanedUp,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "SNAPSHOTTING" => Self::Snapshotting,
                "UPLOADING" => Self::Uploading,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                "CLEANED_UP" => Self::CleanedUp,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Snapshotting => serializer.serialize_i32(2),
                Self::Uploading => serializer.serialize_i32(3),
                Self::Succeeded => serializer.serialize_i32(4),
                Self::Failed => serializer.serialize_i32(5),
                Self::Deleting => serializer.serialize_i32(6),
                Self::CleanedUp => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.VolumeBackup.State",
            ))
        }
    }
}

/// Represents the operation of restoring a volume from a VolumeBackup.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VolumeRestore {
    /// Output only. Full name of the VolumeRestore resource.
    /// Format: `projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*`
    pub name: std::string::String,

    /// Output only. Server generated global unique identifier of
    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.
    pub uid: std::string::String,

    /// Output only. The timestamp when this VolumeRestore resource was
    /// created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this VolumeRestore resource was last
    /// updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The full name of the VolumeBackup from which the volume will
    /// be restored. Format:
    /// `projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*`.
    pub volume_backup: std::string::String,

    /// Output only. The reference to the target Kubernetes PVC to be restored.
    pub target_pvc: std::option::Option<crate::model::NamespacedName>,

    /// Output only. A storage system-specific opaque handler to the underlying
    /// volume created for the target PVC from the volume backup.
    pub volume_handle: std::string::String,

    /// Output only. The type of volume provisioned
    pub volume_type: crate::model::volume_restore::VolumeType,

    /// Output only. The timestamp when the associated underlying volume
    /// restoration completed.
    pub complete_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The current state of this VolumeRestore.
    pub state: crate::model::volume_restore::State,

    /// Output only. A human readable message explaining why the VolumeRestore is
    /// in its current state.
    pub state_message: std::string::String,

    /// Output only. `etag` is used for optimistic concurrency control as a way to
    /// help prevent simultaneous updates of a volume restore from overwriting each
    /// other. It is strongly suggested that systems make use of the `etag` in the
    /// read-modify-write cycle to perform volume restore updates in order to avoid
    /// race conditions.
    pub etag: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl VolumeRestore {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::VolumeRestore::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [uid][crate::model::VolumeRestore::uid].
    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::VolumeRestore::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::VolumeRestore::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::VolumeRestore::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::VolumeRestore::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [volume_backup][crate::model::VolumeRestore::volume_backup].
    pub fn set_volume_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.volume_backup = v.into();
        self
    }

    /// Sets the value of [target_pvc][crate::model::VolumeRestore::target_pvc].
    pub fn set_target_pvc<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::NamespacedName>,
    {
        self.target_pvc = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [target_pvc][crate::model::VolumeRestore::target_pvc].
    pub fn set_or_clear_target_pvc<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::NamespacedName>,
    {
        self.target_pvc = v.map(|x| x.into());
        self
    }

    /// Sets the value of [volume_handle][crate::model::VolumeRestore::volume_handle].
    pub fn set_volume_handle<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.volume_handle = v.into();
        self
    }

    /// Sets the value of [volume_type][crate::model::VolumeRestore::volume_type].
    pub fn set_volume_type<T: std::convert::Into<crate::model::volume_restore::VolumeType>>(
        mut self,
        v: T,
    ) -> Self {
        self.volume_type = v.into();
        self
    }

    /// Sets the value of [complete_time][crate::model::VolumeRestore::complete_time].
    pub fn set_complete_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [complete_time][crate::model::VolumeRestore::complete_time].
    pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.complete_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::VolumeRestore::state].
    pub fn set_state<T: std::convert::Into<crate::model::volume_restore::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_message][crate::model::VolumeRestore::state_message].
    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.state_message = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::VolumeRestore::etag].
    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for VolumeRestore {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.gkebackup.v1.VolumeRestore"
    }
}

/// Defines additional types related to [VolumeRestore].
pub mod volume_restore {
    #[allow(unused_imports)]
    use super::*;

    /// Supported volume types.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum VolumeType {
        /// Default
        Unspecified,
        /// Compute Engine Persistent Disk volume
        GcePersistentDisk,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [VolumeType::value] or
        /// [VolumeType::name].
        UnknownValue(volume_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod volume_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl VolumeType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::GcePersistentDisk => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("VOLUME_TYPE_UNSPECIFIED"),
                Self::GcePersistentDisk => std::option::Option::Some("GCE_PERSISTENT_DISK"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for VolumeType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for VolumeType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for VolumeType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for VolumeType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "VOLUME_TYPE_UNSPECIFIED" => Self::Unspecified,
                "GCE_PERSISTENT_DISK" => Self::GcePersistentDisk,
                _ => Self::UnknownValue(volume_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for VolumeType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::GcePersistentDisk => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for VolumeType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VolumeType>::new(
                ".google.cloud.gkebackup.v1.VolumeRestore.VolumeType",
            ))
        }
    }

    /// The current state of a VolumeRestore
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// This is an illegal state and should not be encountered.
        Unspecified,
        /// A volume for the restore was identified and restore process is about to
        /// start.
        Creating,
        /// The volume is currently being restored.
        Restoring,
        /// The volume has been successfully restored.
        Succeeded,
        /// The volume restoration process failed.
        Failed,
        /// This VolumeRestore resource is in the process of being deleted.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Restoring => std::option::Option::Some(2),
                Self::Succeeded => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Deleting => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Restoring => std::option::Option::Some("RESTORING"),
                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Restoring,
                3 => Self::Succeeded,
                4 => Self::Failed,
                5 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "RESTORING" => Self::Restoring,
                "SUCCEEDED" => Self::Succeeded,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Restoring => serializer.serialize_i32(2),
                Self::Succeeded => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Deleting => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.gkebackup.v1.VolumeRestore.State",
            ))
        }
    }
}
